问题: 环境使用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)
原因:因为google服务的问题把夜神模拟器删除了以后重新装了,结果Appium服务运行的核心文件Appium Settings就被之前代码里desired_caps中的这一行"skipServerInstallation": "true"执行后跳过 Appium 服务器的安装,所以没有这个文件脚本运行的时候appium日志就会报错导致脚本运行也报错执行失败。
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"
转载请注明出处,感谢观看,互相学习!
文章来源地址https://www.toymoban.com/news/detail-597548.html文章来源:https://www.toymoban.com/news/detail-597548.html
到了这里,关于selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred 报错的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!