selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred 报错

 

问题: 环境使用Python执行appium自动化脚本运行夜神模拟器上的app的时候报错,具体错误信息如下:

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
    at getResponseForW3CError (D:\Program Files\nodejs\node_global\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
    at asyncHandler (D:\Program Files\nodejs\node_global\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:392:37)

8d65eddd11dd4b949dbb5f7b6619eb20.png

原因:因为google服务的问题把夜神模拟器删除了以后重新装了,结果Appium服务运行的核心文件Appium Settings就被之前代码里desired_caps中的这一行"skipServerInstallation": "true"执行后跳过 Appium 服务器的安装,所以没有这个文件脚本运行的时候appium日志就会报错导致脚本运行也报错执行失败。

d8ac502d0eb34564a9d968d2fff5d6c8.png

desired_caps = {
    "deviceName": "127.0.0.1:62001",
    "app": r"D:\Program Files\PycharmProjects\app_pytest_framework\app\xxxx.apk",
    "appPackage": "xxxx",
    "appActivity": "xxxx",
    "platformName": "Android",
    "noSign": "true",
    "noReset": "true",
    "resetKeyboard": "true",
    "unicodeKeyboard": "true",
    "connectHardwareKeyboard": "true",
    "ensureWebviewsHavePages": "true",
    "nativeWebScreenshot": "true",
    "skipDeviceInitialization": "true",
    "skipServerInstallation": "true", #跳过 Appium 服务器的安装,ture为是false为否
    "platformVersion": "7.1.2",
    "newCommandTimeout": 240,
    "automationName": "UiAutomator2"
}
# 打开配置字典中指定的 app
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)

解决:废话不多说,直接看解决方案,将true改为false,或者直接将这行代码删除,再次运行脚本就成功解决了!

"skipServerInstallation": "false"

转载请注明出处,感谢观看,互相学习!

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值