Appium appium 微信公众号无法切换 context,chromedriver、webview 都为 57,报错 chrome not reachable

尚酷米 · 2018年08月23日 · 最后由 尚酷米 回复于 2018年09月27日 · 3296 次阅读

问题
appium 微信公众号自动化时,无法切换 webview
1.发现系统版本 webview53,已经打了更新包,更新为 57,同时选择了 webview 的实现方式
2.测试机,电脑均已重启后尝试过

系统环境
1.py3+win10+appium(1.8.1)+oppor11
2.Android system webview 更新 webview 为 57
3.微信已经开启调试模式

appium 报错截图

代码中报错

appium-server 报错日志
发现依然无法切换 context

[ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 4ba06e0e shell ps'
[AndroidDriver] Parsed pid: '10739' pkg: 'com.tencent.mm:toolsmp' from
[AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
[AndroidDriver]     u0_a275   10739 988   2485748 116000 unk           0 0000000000 S com.tencent.mm:toolsmp
[AndroidDriver] Returning process name: 'com.tencent.mm:toolsmp'
[AndroidDriver] Parsed pid: '10728' pkg: 'com.tencent.mm:tools' from
[AndroidDriver]     USER      PID   PPID  VSIZE  RSS  FRZ          WCHAN              PC  NAME
[AndroidDriver]     u0_a275   10728 988   2676548 158708 unk           0 0000000000 S com.tencent.mm:tools
[AndroidDriver] Returning process name: 'com.tencent.mm:tools'
[AndroidDriver] Found webviews: ["WEBVIEW_com.tencent.mm:toolsmp","WEBVIEW_com.tencent.mm:tools"]
[AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.tencent.mm:toolsmp","WEBVIEW_com.tencent.mm:tools"]
[AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com.tencent.mm:tools'
[AndroidDriver] A port was not given, using random port: 8000
[Chromedriver] Changed state to 'starting'
[Chromedriver] The following Chromedriver executables were found:
[Chromedriver]     D:/codes/autotest_server4/codes35_api_jiekuan/guguji/my_drivers/chromedriver_2.29.exe (minimum Chrome version '57.0.2987')
[ADB] Getting package info for 'com.google.android.webview'
[ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 4ba06e0e shell dumpsys package com.google.android.webview'
[Chromedriver] Found Chrome bundle 'com.google.android.webview' version '57.0.2987'
[Chromedriver] Found 1 Chromedriver executable capable of automating Chrome '57.0.2987'.
[Chromedriver] Choosing the most recent, 'D:/codes/autotest_server4/codes35_api_jiekuan/guguji/my_drivers/chromedriver_2.29.exe'.
[Chromedriver] If a specific version is required, specify it with the `chromedriverExecutable`desired capability.
[Chromedriver] Set chromedriver binary as: D:/codes/autotest_server4/codes35_api_jiekuan/guguji/my_drivers/chromedriver_2.29.exe
[Chromedriver] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"8000 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Cleaning any old adb forwarded port socket connections
[ADB] List forwarding ports
[ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 4ba06e0e forward --list'
[Chromedriver] Spawning chromedriver with: D:/codes/autotest_server4/codes35_api_jiekuan/guguji/my_drivers/chromedriver_2.29.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose
[Chromedriver] Chromedriver version: '2.29.461591'
[JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.10240\"}}}"
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"4ba06e0e"}}}
[JSONWP Proxy] Got response with status 200: {"sessionId":"91480890a23673011ffdbad54545bfe0","status":100,"value":{"message":"chrome not reachable\n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64)"}}
[Chromedriver] Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[Chromedriver]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[Chromedriver]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at 
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"4ba06e0e"}}}
[JSONWP Proxy] Got response with status 200: {"sessionId":"646641c468f7338b97540e57b00d115a","status":100,"value":{"message":"chrome not reachable\n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64)"}}
[Chromedriver] Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[Chromedriver]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[Chromedriver]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at 
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"4ba06e0e"}}}
[JSONWP Proxy] Got response with status 200: {"sessionId":"7d28693bd641c89c52f12abf783dbfc2","status":100,"value":{"message":"chrome not reachable\n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64)"}}
[Chromedriver] Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[Chromedriver]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[Chromedriver]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at 
[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"4ba06e0e"}}}
[JSONWP Proxy] Got response with status 200: {"sessionId":"25d5891e13c8c9ef8fb2ee53257afbc5","status":100,"value":{"message":"chrome not reachable\n  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64)"}}
[Chromedriver] Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[Chromedriver]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[Chromedriver]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at 
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[Chromedriver]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[Chromedriver]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at 
[MJSONWP] Encountered internal error running command: Error: Failed to start Chromedriver session: An error occurred (Original error: chrome not reachable
[MJSONWP]   (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10240 x86_64))
[MJSONWP]     at Object.wrappedLogger.errorAndThrow (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[MJSONWP]     at Chromedriver.callee$2$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:411:13)
[MJSONWP]     at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[MJSONWP]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[MJSONWP]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[MJSONWP]     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[MJSONWP]     at 
[HTTP] <-- POST /wd/hub/session/2f8a67fd-9af2-4e7a-93e2-7de97511d622/context 500 249907 ms - 389
[HTTP] 
[UiAutomator2] [UIAutomator2] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[UiAutomator2] [UIAutomator2] INSTRUMENTATION_CODE: 0

求求各位大佬帮忙瞧瞧,2 天了啥手段都尝试了,切换还是报错

共收到 9 条回复 时间 点赞

desired_caps 参数写的有问题

匿名 #2 · 2018年09月13日

加上 args: --no-sandbox
'chromeOptions':
{'androidProcess': 'com.tencent.mm:tools',
'args': ['--no-sandbox']
}
我的完整 caps:
desired_caps = {
'platformName': 'android',
'deviceName': 'vivo Y66',
'appPackage': 'com.tencent.mm',
'appActivity': '.ui.LauncherUI',
'automationName': 'appium',
'unicodeKeyboard': True,
'resetKeyboard': True,
'noReset': True,
'newCommandTimeout': 600,
'chromeAndroidPackage': 'com.tencent.mm',
'recreateChromeDriverSessions': True,
'chromeOptions':
{'androidProcess': 'com.tencent.mm:tools',
'args': ['--no-sandbox']
}
}
如果还是不行,换个手机或许好使

好的大佬 谢谢了

匿名 #5 · 2018年09月17日
尚酷米 回复

你现在怎么样了?微信 6.6.6 版本后好像一直报 chrome not reachable。加个微信聊聊 qq1036181341

没有解决,我试过替换 Android WebView 的版本 切换时还是是吧,然后换了一个测试机就好了;
你可以看看这个https://testerhome.com/topics/15479

我也遇到了相同的问题,报错和你一样的。因为我使用的环境几乎和你一样的,区别有 2 个:一、测试机是荣耀手机,系统是安卓 8.0.0;二、python2.7。你后来换了什么手机吗?和之前的手机区别在哪里?

我换了一台安卓系统 7.1.2 的 vivo 手机,已经可以正常使用,在另一个帖子里面提到了,安卓 8 目前无法支持,官方有 bug。😁

南菲儿 回复

不能切换的是一个 oppor11 然后换了一个魅族就好了

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