简体   繁体   English

X路径对象识别中的Appium-问题

[英]Appium -Issue in Xpath object recognition

I am getting this below error while executing my first appium program: 执行我的第一个appium程序时出现以下错误:

 Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V

The above error is occurring because of the below code: 由于以下代码而发生上述错误:

driver.findElementByXPath("//android.widget.TextView[@text='Preference']").click();

Please help me understand the issue. 请帮助我了解问题。

I ran into a similar issue when I tried using appium with testobject's reporter. 当我尝试与testobject的报告者一起使用appium时遇到了类似的问题。

I solved the issue by adding 我通过添加解决了这个问题

testCompile group: 'com.google.guava', name: 'guava', version: '21.0'

to my gradle dependencies. 对我的gradle依赖。

It seems as though the testobject reporter was using a version of guava that was incompatible with selenium. 似乎testobject报告程序使用的是与硒不兼容的番石榴。

Full dependencies: 完全依赖项:

dependencies {
    testCompile group: 'org.testng', name: 'testng', version: '6.8'
    compile group: 'io.appium', name: 'java-client', version: '5.0.4'
    testCompile 'org.seleniumhq.selenium:selenium-server:2.53.0'
    compile group: 'org.json', name: 'json', version: '20180130'
    compile group: 'org.apache.clerezza.ext', name: 'org.json.simple', version: '0.4'
    testCompile 'org.testobject:testobject-appium-java-api:0.1.0'
    //this is here to overwrite the guave dependency from the testobject repo. If not overwritten, causes error
    testCompile group: 'com.google.guava', name: 'guava', version: '21.0'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM