搭建过程见
http://blog.youkuaiyun.com/jlminghui/article/details/41121479
作者
北极的冰箱
由于blog中作者使用的版本和目前最新稍有不同,导致程序无法正确执行。
首先发现这个问题
That URL did not map to a valid JSONWP resource
代码位置
driver = new AppiumDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
此处是由于使用的java-client1.0版本引起的,我现在换成java-client2.2.0版本。
启动后,还是失败。
13:07:06.426 WARN - Exception: The path to the driver executable must be set by
the webdriver.ie.driver system property; for more information, see http://code.g
oogle.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be down
loaded from http://selenium-release.storage.googleapis.com/index.html
原来是java-client2.0版本以后,将把AppiumDriver这个类改成了抽象函数
解决
1.导入包
import io.appium.java_client.android.*;
2.重新定义driver
private AppiumDriver driver;
TO
private AndroidDriver driver;
3.更改代码
driver = new AppiumDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
TO
driver = new AndroidDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
运行程序,问题解决。
在尝试搭建Appium实例时,作者遇到了'URL did not map to a valid JSONWP resource'的问题。问题源于java-client版本差异,从1.0升级到2.2.0后,AppiumDriver变为抽象类。解决方案包括导入新包,将driver类型更改为AndroidDriver,并修改构造函数调用,最终成功运行程序。
3194

被折叠的 条评论
为什么被折叠?



