Unable to locate elements with special characters($) in their locator values
See original GitHub issueThe problem
Unable to locate elements with special characters($) in their locator values
Environment
Appium version 1.8.0 Desktop OS/version used to run Appium: Windows 10 Pro Node.js version (unless using Appium.app|exe): 8.10.0 Mobile platform/version under test: Android API 25 ,v7.1.1 Real device or emulator/simulator: Real Device Samsung Tab Appium CLI or Appium.app|exe: both
Ecxeption stacktraces
May 10, 2018 6:27:58 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
md52da4fc008d6b8a11b2105cb85a17be71.LoginView
Select Vehicle screen is displayed
ABC 123
Exception in thread "main" org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {stacktrace=InvalidSelectorError: Argument was an invalid selector (e.g. XPath/CSS).
at errorFromMJSONWPStatusCode (C:\Users\gokulnath.kumar\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:769:12)
at Socket.<anonymous> (C:\Users\gokulnath.kumar\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-bootstrap\lib\bootstrap.js:129:18)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:246:13)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20), error=invalid selector, message=Argument was an invalid selector (e.g. XPath/CSS).}
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'IN-GOKUL-D', ip: '172.22.237.81', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '10'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:326)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:421)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:140)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at sign_in.signing.main(signing.java:75)
Caused by: java.lang.ClassCastException: com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to org.openqa.selenium.WebElement
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:324)
... 8 more
Link to Appium logs
https://gist.github.com/Gocoollnath/18375636f56469faedea7593f454c43f
Code To Reproduce Issue [ Good To Have ]
driver.findElementByXPath(“(//android.app.ActionBar$Tab)[2]”).click();
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
[WebDriver] cannot verify text present if the content contains ...
[InvalidSelectorError] Unable to locate an element with the xpath ... and it will work fine if the value variable doesn't contain any special...
Read more >Unable to locate element / Cant find element - Stack Overflow
I am trying to access a specific element but somehow cant get it working. Site is loaded and i can access other parts...
Read more >Locators In Selenium WebDriver With Examples - LambdaTest
Selenium WebDriver provides the findElement() and findElements() method to locate the WebElements using the appropriate web locator.
Read more >Using Cypress - Cypress Documentation
How do I get the native DOM reference of an element found using Cypress? ... How do I use special characters with cy.get()?;...
Read more >Chapter-4: Appium Locator Finding Strategies - Kobiton
After all, if you're unable to “find” the UI element, you cannot control it ... Here id is the Locator strategy and Login...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Gocoollnath, if xpath does not work, use UiSelector instead.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.