Exception in thread "main" org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement


#1

HI all,

I am trying to automate an app on IOS12 device . When i ran a sample test case with below configuration i came across “Exception in thread “main” org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement” which is Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.openqa.selenium.WebElement

Attached Test Project

Configuration:
Xcode: 10.0
Appium Server: 1.9.1
Java-Client: 5.0.4
Selenium-Java: 3.6.0
IOS version: 12.0
Mac OS: 10.13.6(High Sierra)
JDK8

Console Error:

Exception in thread “main” org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=EC6652AE-2DF4-46DB-9DFE-3810DB6880A2}
Build info: version: ‘3.6.0’, revision: ‘6fbf3ec767’, time: ‘2017-09-27T15:28:36.4Z’
System info: host: ‘AIM00215.local’, ip: ‘169.254.7.106’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_191’
Driver info: driver.version: IOSDriver
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
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.ios.IOSDriver.findElement(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:458)
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.ios.IOSDriver.findElementByXPath(IOSDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)
at ios.test.VerifyIosSetup.main(VerifyIosSetup.java:56)
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:361)
… 13 more

Appium Log:
AppiumLog.txt (10.6 KB)

Note:

  1. The Same setup is working with Selenium-Java(2.53.1) and Java-Client(4.1.2)
  2. I have tried different combinations with selenium and java client after browsing through the same issue posted by others but no luck

Please help me with this and let me know there is something i am missing out.

Project URL:


#2

check this post

ksurya28995 commented 24 days ago
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”);


#3

Thanks for taking time to help but this is not working.
I could not figure out which version of selenium and java-client to be used with appium 1.9.1 server to work on ios12(Using Xcode 10.0)