手机自动化测试:appium问题解决
Appium遇到问题:
问题一:
问题org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
解决办法:
(1)启动appium
(2)运行cmd 输入 adb devices -l 查看UDID 如图:
(3)再在cmd中输入 appium -a 127.0.0.1 -p4723 -Uf4a4d8bb (-a表示ip,-p表示端口,-U表示设备的udid 可以通过appium -h查看更多命令)
(4)如果如下图所示 就表示 appium服务启动成功了,注意这个窗口不要关闭 因为这是appium的服务 关了就关了服务,后面过程无法执行,而且这个窗口也是 日志输出的窗口用于排错。
问题二:
问题:org.openqa.selenium.SessionNotCreatedException: A new session could not be created.
(Original error: Device ZX1C622BU3 was not in the list of connected devices)
(WARNING: The server did not provide any stacktrace information)
解决办法:可能手机驱动未安装成功,虽然在adb devices中可以正常查看到devices
问题三:
问题:org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Waited 20 secs for selendroid server and it never showed up)
解决办法:
查看包的签名的和Activity
例如:APP从I5版本后启动界面的capabilities.setCapability("appActivity", ".CordovaApp");
从I5版本后Acitivity变成了MainActivity
capabilities.setCapability("appActivity",".MainActivity");// 被测app的Activity类
问题四:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
解决方法:
查看设备上是否安装Selendroid,或者升级Selendroid
IOS问题五:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
解决办法:IOS_webkit_debug_proxy –c –[Udid] -d