org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement

if u required any more details pls ask me. I am new to github.

@JithendraKumarCS i added comment. give a try.

  1. client jar 5.0.1 and 5.0.2 and error is

driver startedā€¦
Exception in thread ā€œmainā€ java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement

  1. client jar 5.0.0BetaA8 and error is

driver startedā€¦
tap ā€˜oneā€™
Exception in thread ā€œmainā€ org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
error occuredā€¦

  1. client jar 5.0.0BetaA6 and error is

If I downgraded the appium client jar file, we need comment waitAction method like,

new TouchAction(driver).press(el_1.get(0)); //.waitAction(Duration.ofMillis(70)).release().perform();

result is:

driver startedā€¦
tap ā€˜oneā€™
tap ā€˜nineā€™
tap ā€˜eightā€™

But it didnt click on the keypad !!!

@JithendraKumarCS return to java client 5.0.2. and check https://github.com/appium/java-client/issues/709

in general you should update selenium OR try to add guava. for me it is only this enough.
in pom:

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>22.0</version>
        </dependency>

or download it jar and add it into dependency for your project.

  1. new TouchAction(driver).press(el_1.get(0)); //.waitAction(Duration.ofMillis(70)).release().perform();

THIS will not work cause no release and perform.

with old client it should be like similar:

new TouchAction(driver).press(el_1.get(0)).waitAction(70).release().perform();
1 Like
  1. client jar 5.0.2 and selenium 3.5.2

driver startedā€¦
tap ā€˜oneā€™
Exception in thread ā€œmainā€ org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)

@JithendraKumarCS enable debug logs with appium server and share at gist

I have commented in gist, the entire log of appium

@JithendraKumarCS there is some shā€¦t that preventing automator work correctly on your device. check - https://stackoverflow.com/questions/41654828/unable-to-perform-any-operation-on-real-device-using-appium-for-native-app-autom/43261538

Yes it workedā€¦ Thank you very much for all your patience and supportā€¦
Actually it is of Debugging (Security Settings) option.
How did you get this point from log of appium

Hi,

New in Appium for Android via Windows.
My set-up:
appium server 1.7.0
java-client 5.0.4
selenium-server-standalone-3.0.0-beta1.jar or selenium-server-standalone-3.7.1.jar (began from 3.0.0beta, received Exception, tried to use newer version - the same exception)

Getting the same exception:
org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {ELEMENT=1}

Should I downgrade all components as described above?
Should I use selenium-java.jar instead of selenium-server-standalone?

download recent jave-client and selenium stand alone server,
check ur mobile settingsā€¦
In my mobile MI there is option which need to be on mode, so better to check with mobile device onceā€¦

I do use the latest java-client (https://mvnrepository.com/artifact/io.appium/java-client/5.0.4) and selenium-server-standalone (http://www.seleniumhq.org/download/)

Start driver works on my device. So it is not the issue described here: https://stackoverflow.com/questions/41654828/unable-to-perform-any-operation-on-real-device-using-appium-for-native-app-autom/43261538

Android version 4.2.2

With the following setting it works:
Appium 1.7.1
Java-client 5.0.4
Selenium-java 3.6.0

Tried with the latest jars:
Appium 1.7.1
Java-client 5.0.4
Selenium-java 3.7.1

No exception!

I am facing the same issue with

public static MobileElement waitForMobileElementToBeClickable(By by) {
return (MobileElement) wait.until(ExpectedConditions.elementToBeClickable(by));
}

org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement
Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:358)

Appium: 1.7.2
Java-client - 4.1.2
Selenium - 3.9.1

Which Android version you are using?

I am also getting these error for Appium, 1.8
Android Version 7.1

Hello,
Iā€™m getting below error message.Pls. help me to fix & let me know if you need any additional info.

Exception in thread ā€œmainā€ org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1}.

Appium 1.7.1
Java-client 5.0.4
Selenium-serverstandalone 3.7.1 jar.

Hi Frnds,

I found the solution, but cant explain how it works. But it works for me as a miracle.

Just add the below line, and magic happens. I dont have any idea how that makes it workā€¦HAHAHAā€¦

capability.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, ā€œ60ā€);

2 Likes

@Surya_Kumaresan - i cant thank you more. it worked for me to. what does this command do ?? ā€¦ i will read the documentation again to understand how the hell it made it work.