Returned value cannot be converted to WebElement
See original GitHub issueThe problem
I know there is a lot of issues about this exception but none of the solutions work for me. So, I recently updated everything mobile chrome, mobile webview, desktop chromedriver, uiautomator2 and also appium 1.14.2 (also tried new 1.15.0 beta with the same result). And after this the casual try-catch blocking catching NoSuchElementException (for instance checking license popup, if doesn’t appear ok, probably accepted before so move on) started doing this:
Returned value cannot be converted to WebElement: {message=no such element: Unable to locate element: {“method”:“xpath”,“selector”:“//span[@class=‘oj-button-text’ and text()=‘Agree’]”} (Session info: chrome=76.0.3809.132) (Driver info: chromedriver=75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}),platform=Linux 4.15.0-62-generic x86_64)}
Environment
- Appium version that exhibits the issue: 1.14.2
- Last Appium version that did not exhibit the issue (if applicable): 1.14.0
- Desktop OS/version used to run Appium: Linux Mint 19.1
- Node.js version: 8.10.0
- Npm version: 6.9.0
- Mobile platform/version under test: Android 7.1.1 and Android 7
- Real device or emulator/simulator: Real devices
- Appium CLI or Appium.app|exe: CLI
Link to Appium logs
https://gist.github.com/TheHDX/757581829238ddae453afbeab8b7ca14
Code To Reproduce Issue [ Good To Have ]
public boolean isElementPresent(By by) {
try {
return driver.findElement(by).isDisplayed();
} catch (NoSuchElementException e) {
return false;
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top GitHub Comments
Perhaps because of chromedriver update, because since v76 it defaults to w3c protocol
This is the problem of java client, which has been addressed in https://github.com/appium/java-client/pull/1216
You could also forcefully set the chromedriver protocol to jsonwp to workaround it