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


#21

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


#22

@JithendraKumarCS i added comment. give a try.


#23
  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 !!!


#24

@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();

#25
  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)


#26

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


#27

I have commented in gist, the entire log of appium


#28

@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


#29

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


#30

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?


#31

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…


#32

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


#33

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


#34

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

No exception!


#35

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


#36

Which Android version you are using?


#37

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


#38

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.


#39

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”);


#40

@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.