1.首次启动Appium会在设备上安装2个守护app,Appium Settings和Unlock 部分设备系统由于权限的问题(如:三星S6 edge+)需要用户手动确认安装,否则不安装守护App会导致脚本运行失败,安装好后不要随意卸载这两个App。
webdriver模块源码路径:
{python安装路径}}\Lib\site-packages\appium\webdriver
urllib.error.URLError: <urlopenerror[WinError 10061]由于目标计算机积极拒绝,无法连接。
【解决方案】点击启动Appium按钮后,出现[Appium] Welcome to Appium v1.7.2提示后再运行脚本
error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress
【报错分析】 之前的会话没有关闭,然后你又运行了测试实例,也没有设置覆盖.
【解决方案】 重新停止appium服务,开启Appium服务 在AdVance界面勾选Allow Session Override选项 ,重启Appium 测试结束在AfterClass加driver.quit()
selenium.common.exceptions.WebDriverException:Message:Anewsession could not be created. (Originalerror:‘java -version‘failed.Error:Commandfailed:C:\WINDOWS\system32\cmd.exe/s /c"java -version"
selenium.common.exceptions.WebDriverException: Message: An unknown server-sideerroroccurredwhileprocessing the command. Original error: Couldnotfinda connected Android device.
【解决方案】由于设备未连接,或者连接后未开启USB Debug。需要重新连接设备即可。
更换手机设备后如下对应的属性要记得更新,否则无法正常运行脚本。
desired_caps[‘platformVersion‘] =‘XXX‘
desired_caps[‘deviceName‘] =‘Galaxy S6 edge+‘
Activity usedtostart app doesn‘t existorcannot be launched! Make sureitexistsandisa launchable activity
【解决方案】
Failure [INSTALL_FAILED_USER_RESTRICTED])
【解决方案】
Anunknown server-sideerroroccurredwhileprocessing the command”whileopening theApp
【解决方案】重新启动Appium服务
原文:https://www.cnblogs.com/onlyhold/p/10659007.html