Skip to content

Returned value cannot be converted to WebElement #1218

Description

@gepsl

Description

I want to run selenium tests on Android device and I'm using Appium. Using chomedriver 74 version and chrome version 75 everything working correctly, but after update chrome to version 76, I had to change chromedriver to 76 version and I have an error. Tests starts, but after WebDriverWait.until(ExpectedConditions.invisibilty or visibility) fails. It sems that tests correctly waiting for invisibilty of element, but when it disappear error is ocurred:

Environment

  • java client build version : 7.2.0 and 7.1.0
  • Appium server version: 1.14.2 and 1.14.0
  • Desktop OS/version: Windows 10 and Linux
  • Mobile platform: Android
  • Real device : Huawei P10 and Xiaomi Mi8

Code

 WebDriverWait wait = new WebDriverWait(webDriver, time);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath)));

Ecxeption stacktraces

java.lang.AssertionError: Waiting for WebElement 'INIT SYNC POPUP' to be invisible failed

java.lang.AssertionError: Waiting for WebElement 'INIT SYNC POPUP' to be invisible failed

at org.testng.Assert.fail(Assert.java:85)
at Application.Helpers.Assert.fail(Assert.java:11)
at Application.Helpers.ElementWeb.waitToBecomeInvisible(ElementWeb.java:219)
at Application.Pages.Application.Home.waitForSynchronize(Home.java:67)
at Application.ApplicationTest.loginAndSynchronize(ApplicationTest.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.testng.TestRunner.privateRun(TestRunner.java:770)
at org.testng.TestRunner.run(TestRunner.java:591)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
at org.testng.SuiteRunner.run(SuiteRunner.java:304)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
at org.testng.TestNG.runSuites(TestNG.java:1032)
at org.testng.TestNG.run(TestNG.java:1000)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: {message=no such element: Unable to locate element: {"method":"xpath","selector":"//div[@Class='loading-wrapper']"}
(Session info: chrome=76.0.3809.111)
(Driver info: chromedriver=76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Windows NT 10.0.17763 x86_64)}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'CPX-EHN1NDZU8OH', ip: '172.28.64.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: driver.version: AppiumDriver
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:333)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:151)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:57)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions$20.apply(ExpectedConditions.java:577)
at org.openqa.selenium.support.ui.ExpectedConditions$20.apply(ExpectedConditions.java:573)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at Application.Helpers.ElementWeb.waitToBecomeInvisible(ElementWeb.java:207)
... 29 more
Caused by: java.lang.ClassCastException: com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to org.openqa.selenium.WebElement
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:331)
... 42 more

Link to Appium logs

https://gist.github.com/GerardLarwa/49833fad87cbcdedd0a8a349aeca32af

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions