Appium appium-desktop1.0.0 (appium1.6.4) 多次切换 context 报错

太阳糖 · 2017年04月13日 · 最后由 太阳糖 回复于 2017年04月20日 · 1686 次阅读

应用版本信息:

Android 6.0.1、微信 6.5.7、X5 内核 chrome 53.0.2785.49、appium-desktop 1.0.0、chromedriver 2.26

说明:

appium-desktop 1.0.0 自带 chromedriver 版本太高 微信 X5 chrome 版本 53.0.2785.49 最高支持 chromedriver 2.26

appium 第一次切换到 webview 日志:

[AndroidDriver] A port was not given, using random port: 8000
[Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.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] Spawning chromedriver with: C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30) on port 8000
Only local connections are allowed.

第二次切换到 webview 日志:

[AndroidDriver] A port was not given, using random port: 8001
[Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
[Chromedriver] Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (netstat -nao ^| findstr /R /C:"8001 ") 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] Spawning chromedriver with: C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8001 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30) on port 8001
Only local connections are allowed.

报错信息:

[JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8001/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"02157df27164db19"}}}
[JSONWP Proxy] Got response with status 200: {"sessionId":"d189747b2b9f3c4a62a8a77543133bac","status":33,"value":{"message":"session not created exception\nfrom unknown error: failed to close UI debuggers\n (Session info: chrome=53.0.2785.49)\n (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)"}}
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: session not created exception
from unknown error: failed to close UI debuggers
(Session info: chrome=53.0.2785.49)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
Error: session not created exception
from unknown error: failed to close UI debuggers
(Session info: chrome=53.0.2785.49)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: session not created exception
from unknown error: failed to close UI debuggers
(Session info: chrome=53.0.2785.49)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64)
at Chromedriver.callee$2$0$ (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:176:15)
at tryCatch (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\XXX\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)

错产生原因是,第一次创建 chromedriver 使用随机端口 8000,第二次创建 chromedriver 使用随机端口 8001,但是第二次创建 chromedriver 时 kill 的是 8001 端口的 chromedriver,而不是 8000 端口的,所以就用两个 chromedriver 同时存在

共收到 3 条回复 时间 点赞

确实是 appium 1.6.4 的问题

觉得 appium1.6.4 比较多问题

问题已经提给官方了

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