Appium 大神求教:appium1.7.0 切换 webview 时报错:Error: session not created exception: please close ''

林寒 · 2017年10月07日 · 最后由 林寒 回复于 2018年05月05日 · 2407 次阅读
  • 问题描述:

在切换 webview 的时候报错

  • 运行环境:

android 真机:4.4.2 -vivo
appium:1.7.0
python:2.7.10

  • appium 报错日志:
[debug] [AndroidDriver] Returning process name: 'com.tencent.mm:tools'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.tencent.mm:appbrand0","WEB
VIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:support"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.tencent.m
m:appbrand0","WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:support"]
[debug] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIV
E_APP","WEBVIEW_com.tencent.mm:appbrand0","WEBVIEW_com.tencent.mm:tools","WEBVIE
W_com.tencent.mm:support"]
[HTTP] <-- GET /wd/hub/session/e4bc2c70-f4a4-4dff-8c76-3e241a961d70/contexts 200
 429 ms - 185
[HTTP] --> POST /wd/hub/session/e4bc2c70-f4a4-4dff-8c76-3e241a961d70/context {"s
essionId":"e4bc2c70-f4a4-4dff-8c76-3e241a961d70","name":"WEBVIEW_com.tencent.mm:
tools"}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_com.ten
cent.mm:tools","e4bc2c70-f4a4-4dff-8c76-3e241a961d70"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","cat","/proc/net/unix"]
[debug] [AndroidDriver] WEBVIEW_21595 mapped to pid 21595
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_21833 mapped to pid 21833
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_21628 mapped to pid 21628
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","ps"]
[debug] [AndroidDriver] Parsed pid: '21595' pkg: 'com.tencent.mm:appbrand0' from

[debug] [AndroidDriver]     USER     PID   PPID  VSIZE  RSS     WCHAN    PC
    NAME
[debug] [AndroidDriver]     u0_a134   21595 227   1241516 70632 ffffffff 0000000
0 S com.tencent.mm:appbrand0
[debug] [AndroidDriver] Returning process name: 'com.tencent.mm:appbrand0'
[debug] [AndroidDriver] Parsed pid: '21833' pkg: 'com.tencent.mm:tools' from
[debug] [AndroidDriver]     USER     PID   PPID  VSIZE  RSS     WCHAN    PC
    NAME
[debug] [AndroidDriver]     u0_a134   21833 227   1531512 115292 ffffffff 000000
00 R com.tencent.mm:tools
[debug] [AndroidDriver] Returning process name: 'com.tencent.mm:tools'
[debug] [AndroidDriver] Parsed pid: '21628' pkg: 'com.tencent.mm:support' from
[debug] [AndroidDriver]     USER     PID   PPID  VSIZE  RSS     WCHAN    PC
    NAME
[debug] [AndroidDriver]     u0_a134   21628 227   1242300 71148 ffffffff 0000000
0 S com.tencent.mm:support
[debug] [AndroidDriver] Returning process name: 'com.tencent.mm:support'
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.tencent.mm:appbrand0","WEB
VIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:support"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.tencent.m
m:appbrand0","WEBVIEW_com.tencent.mm:tools","WEBVIEW_com.tencent.mm:support"]
[debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com
.tencent.mm:tools'
[debug] [AndroidDriver] A port was not given, using random port: 8000
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: E:\node\node_global\node_modules\appi
um\node_modules\_appium-chromedriver@3.0.1@appium-chromedriver\chromedriver\win\
chromedriver.exe
[debug] [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
[debug] [Chromedriver] Cleaning any old adb forwarded port socket connections
[debug] [ADB] List forwarding ports
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","forward","--list"]
[Chromedriver] Spawning chromedriver with: E:\node\node_global\node_modules\appi
um\node_modules\_appium-chromedriver@3.0.1@appium-chromedriver\chromedriver\win\
chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/h
ub/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"stat
us\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86\",\"n
ame\":\"Windows NT\",\"version\":\"6.1.7600\"}}}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/w
d/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPacka
ge":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.m
m:tools","androidDeviceSerial":"116537b"}}}
[debug] [Chromedriver] Webview version: 'Chrome/53.0.2785.49'
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"26d2a31b59256
315521a302de03897b5","status":33,"value":{"message":"session not created excepti
on: please close '' and try again\n  (Driver info: chromedriver=2.30.477700 (005
7494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7600 x86)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/w
d/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPacka
ge":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.m
m:tools","androidDeviceSerial":"116537b"}}}
[debug] [Chromedriver] Webview version: 'Chrome/53.0.2785.49'
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"9ea02cff21fc6
aff4172affd56e0d27b","status":33,"value":{"message":"session not created excepti
on: please close '' and try again\n  (Driver info: chromedriver=2.30.477700 (005
7494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7600 x86)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/w
d/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPacka
ge":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.m
m:tools","androidDeviceSerial":"116537b"}}}
[debug] [Chromedriver] Webview version: 'Chrome/53.0.2785.49'
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"dece10706c987
2d8aee3cf9d20edd986","status":33,"value":{"message":"session not created excepti
on: please close '' and try again\n  (Driver info: chromedriver=2.30.477700 (005
7494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7600 x86)"}}
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/w
d/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPacka
ge":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.m
m:tools","androidDeviceSerial":"116537b"}}}
[debug] [Chromedriver] Webview version: 'Chrome/53.0.2785.49'
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"8c7f9071e615b
ff6bee73e8421718b20","status":33,"value":{"message":"session not created excepti
on: please close '' and try again\n  (Driver info: chromedriver=2.30.477700 (005
7494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7600 x86)"}}
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: session not created exception: please close '' and try aga
in
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce
41),platform=Windows NT 6.1.7600 x86)
    at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:197:15)
    at tryCatch (E:\node\node_global\node_modules\appium\node_modules\_babel-run
time@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (E:\node\node_global\node_
modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runt
ime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (E:\n
ode\node_global\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-run
time\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (E:\node\node_global\node_modules\appiu
m\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37
)
 Error: session not created exception: please close '' and try again
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce
41),platform=Windows NT 6.1.7600 x86)
    at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:197:15)
    at tryCatch (E:\node\node_global\node_modules\appium\node_modules\_babel-run
time@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (E:\node\node_global\node_
modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runt
ime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (E:\n
ode\node_global\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-run
time\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (E:\node\node_global\node_modules\appiu
m\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37
)
[MJSONWP] Encountered internal error running command: Error: session not created
 exception: please close '' and try again
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce
41),platform=Windows NT 6.1.7600 x86)
    at Chromedriver.callee$2$0$ (../../lib/chromedriver.js:197:15)
    at tryCatch (E:\node\node_global\node_modules\appium\node_modules\_babel-run
time@5.8.24@babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (E:\node\node_global\node_
modules\appium\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runt
ime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (E:\n
ode\node_global\node_modules\appium\node_modules\_babel-runtime@5.8.24@babel-run
time\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (E:\node\node_global\node_modules\appiu
m\node_modules\_babel-runtime@5.8.24@babel-runtime\regenerator\runtime.js:136:37
)
[HTTP] <-- POST /wd/hub/session/e4bc2c70-f4a4-4dff-8c76-3e241a961d70/context 500
 5765 ms - 350
[HTTP] --> DELETE /wd/hub/session/e4bc2c70-f4a4-4dff-8c76-3e241a961d70 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["e4bc2c70-f4a
4-4dff-8c76-3e241a961d70"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1507358078065 (14:34
:38 GMT+0800 (中国标准时间))
[Appium] Removing session e4bc2c70-f4a4-4dff-8c76-3e241a961d70 from our master s
ession list
[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","am","force-stop","com.tencent.mm"]
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","input","keyevent",3]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":
"shutdown"}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"O
K, shutting down","status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomato
rTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunS
erver
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appi
um.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter
=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 37.223
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'E:\android\android-sdk-windows\platform-tools\adb.exe' wi
th args: ["-P",5037,"-s","116537b","shell","am","force-stop","io.appium.unlock"]

[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` cap
ability if wanted.
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1507358080840 (14:34:
40 GMT+0800 (中国标准时间))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/e4bc2c70-f4a4-4dff-8c76-3e241a961d70 200 2807
ms - 76
共收到 6 条回复 时间 点赞
恒温 屏蔽了此话题:排版问题 10月08日 06:38

@Lihuazhang 修改好了,麻烦审核下,谢谢

@Lihuazhang 是节点不对吗?还是描述不清楚?请指教

我也遇到这个问题,楼主的问题解决了吗?

我也是。。。。之前能切换 webview,现在就不行了

我也遇到这个问题了,有人能解一下吗...

好久没来看了,已经解决了,使用最新的 appium-desktop 就可以 @poppyupup @chenyh @wuxisanhuo

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