Returned value cannot be converted to WebElement

我的梦境 提交于 2019-11-29 12:31:28

Hi Please use following dependencies :

  <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>6.0.0-BETA5</version>
        </dependency>
 <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.9.1</version>
        </dependency> 

This should solve your problem, even i faced similar issue when i used different selenium server version.

I was struggling with this issue for a couple of days. I tried all the solutions mentioned on various forums like upgrading or downgrading the appium version etc. Finally, the issue was resolved by adding a simple implicit wait of 5 seconds on the driver object. Give it a try if you are facing this issue.

If someone is seeing this now, then WebElement search depends upon the what driver you are using.

If AndroidDriver is used then refer generic type as AndroidDriver driver; driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

If appiumDriver is used then refer generic type as AppiumDriver driver; driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

hope it helps!

In the Desired Capabilities add the following additional Capabilities, it should work then:

capability.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "60");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!