question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returned value cannot be converted to WebElement

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, Sep 18, 2019

Perhaps because of chromedriver update, because since v76 it defaults to w3c protocol

1reaction
mykola-mokhnachcommented, Sep 18, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

appium - Returned value cannot be converted to WebElement
I was struggling with this issue for a couple of days. I tried all the solutions mentioned on various forums like upgrading or...
Read more >
Error returned value cannot be converted into web element
I am getting the below error “Exception in thread “main” org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: ...
Read more >
"Returned value cannot be converted to WebElement ...
I was using following combination: Appium : 1.6.5 Selenium : selenium-java-3.3.1 Appium Java Client : java-client-5.0.3.
Read more >
Returned value cannot be converted to WebElement #1218
Description I want to run selenium tests on Android device and I'm using Appium. Using chomedriver 74 version and chrome version 75 ...
Read more >
Returned value cannot be converted to WebElement element ...
I am getting error says "Returned value cannot be converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1}" when trying to click the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found