Appium 求助贴,app 用 X5 替换了系统自带的浏览器,无法切换 context 过一段时间后报错 `Original error: chrome not reachable`

cx · 2017年06月13日 · 最后由 盐咖啡 回复于 2020年07月29日 · 2750 次阅读

大家好,之前由于 Android 端 App 把系统内核用 X5 浏览器内核替换,导致我无法切换 context 同时 Appium 无法查看 web 页元素,根据论坛上大神的方法配置了后,还是不行,大家有遇到过这种问题吗,怎么解决的?

配置

  • Appium version:v1.6.4
  • Appium inspector:1.1.0-beta.1
  • System version:4.4.4

    def setUp(self):
    
        desired_caps = {}
        desired_caps['platformName'] = constants.Android_Platform_Name
        desired_caps['platformVersion'] = constants.Andriod_Platfrom_Version
        desired_caps['deviceName'] = constants.Andriod_Device_Name
        desired_caps['unicodeKeyboard'] = "True"
        desired_caps["resetKeyboard"] = "True"
        desired_caps["noReset"] = "True"
        desired_caps["chromeOptions"] = {'androidProcess':'com.tencent.smtt:tools'}
        desired_caps['app'] = PATH(
           constants.Apk_Dir
        )
    
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    

    错误 log

    {"androidPackage":"com.jd.jrapp","androidUseRunningApp":true,"androidProcess":"com.tencent.smtt:tools","androidDeviceSerial":"5DYTG6DIVWEQT849"}}}
    [JSONWP Proxy] Got response with status 200: {"sessionId":"2ef2252a817df311cb69a6b131a20a6b","status":100,"value":{"message":"chrome not reachable\n  (Driver info: chromedriver=2.28.455517 (2c6d2707d8ea850c862f04ac066724273981e88f),platform=Mac OS X 10.12.4 x86_64)"}}
    [Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
    [Chromedriver] Changed state to 'stopped'
    [Chromedriver] Error: chrome not reachable
    (Driver info: chromedriver=2.28.455517 (2c6d2707d8ea850c862f04ac066724273981e88f),platform=Mac OS X 10.12.4 x86_64)
    at Chromedriver.callee$2$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-chromedriver/lib/chromedriver.js:176:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    Error: chrome not reachable
    (Driver info: chromedriver=2.28.455517 (2c6d2707d8ea850c862f04ac066724273981e88f),platform=Mac OS X 10.12.4 x86_64)
    at Chromedriver.callee$2$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-chromedriver/lib/chromedriver.js:176:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    [MJSONWP] Encountered internal error running command: Error: chrome not reachable
    (Driver info: chromedriver=2.28.455517 (2c6d2707d8ea850c862f04ac066724273981e88f),platform=Mac OS X 10.12.4 x86_64)
    at Chromedriver.callee$2$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-chromedriver/lib/chromedriver.js:176:15)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    [HTTP] <-- POST /wd/hub/session/d263497b-56fd-4605-81b1-897dbfd4c616/context 500 244334 ms - 310 
    [HTTP] --> DELETE /wd/hub/session/d263497b-56fd-4605-81b1-897dbfd4c616 {}
    [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["d263497b-56fd-4605-81b1-897dbfd4c616"]
    [BaseDriver] Event 'quitSessionRequested' logged at 1497346805693 (17:40:05 GMT+0800 (CST))
    [AndroidDriver] Shutting down Android driver
    [AndroidDriver] Resetting IME to io.appium.android.ime/.UnicodeIME
    
共收到 3 条回复 时间 点赞

同求此问题!前几天我们这边开发也是告诉我内核换成 x5 了,然后可以获取很多 webview 页面出来——导致我这边切换失效...谷歌以及 chromedriver 目前是 62 和 3.34 个人感觉这里是匹配的,我是用的 python@

cx #2 · 2018年03月12日 Author

1.去下载一个 X5 浏览器官网下载一个 tbs 工具
2.降低 chromedriver 的版本号,应该是 20 左右,我也忘了,不好意思

我也卡在了这个问题,死活且不过去。请问大佬们都解决了吗

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册