环境:
Android 版本 6.0.1
Android 机型 Moto XT1085
Appium 1.6.5
PC 及 Android 的 Chrome 版本都是 59
chromedriver 2.22(inspect 显示的 webview 版本为 51)
脚本:
*** Settings ***
Library AppiumLibrary
*** Test Cases ***
open application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=6.0.1 deviceName=TA09004RBC appPackage=com.china3s.strip appActivity=com.china3s.spring.view.home.activity.MainAct
... recreateChromeDriverSessions=True
Click Element id=com.china3s.strip:id/et_search
${a} get contexts
switch to context WEBVIEW_com.china3s.strip
${b} get current context
Input Text id=searchInput ${productId}
Press Keycode 66 ##执行完Press之后页面跳转了
Click Element //*[@id="JS_searchList"]/ul/li/a ##在执行该行就停住了, 最后报错
log(我就截了从 chromedriver 开始到最后的部分,之前的操作都正常):
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: C:\Users\016834\AppData\Roaming\npm\n
ode_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedrive
r.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=="" TASK
KILL /F /PID %a))
[Chromedriver] No old chromedrivers seemed to exist
[Chromedriver] Spawning chromedriver with: C:\Users\016834\AppData\Roaming\npm\n
ode_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedrive
r.exe --url-base=wd/hub --port=8000 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.22.397933 (1cab651507b88dec79b2b
2a22d1943c01833cc1b) on port 8000
Only local connections are allowed.
[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_64\",
\"name\":\"Windows NT\",\"version\":\"6.1.7601 SP1\"}}}"
[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.china3s.strip","androidUseRunningApp":true,"androidDeviceSerial":"TA090
04RBC"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":{"acceptSslCerts":true,"applicationCache
Enabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":
{"chromedriverVersion":"2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b)"}
,"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTou
chScreen":true,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmu
lationEnabled":false,"nativeEvents":true,"platform":"ANDROID","rotatable":false,
"takesHeapSnapshot":true,"takesScreenshot":true,"version":"51.0.2704.106","webSt
orageEnabled":true}}
[debug] [Chromedriver] Changed state to 'online'
[debug] [MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/context 200
2502 ms - 76
[HTTP] --> GET /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/context {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentContext() with args: ["9c90d4a6
-658d-4e3a-8c87-f950b15a2d48"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "
WEBVIEW_com.china3s.strip"
[HTTP] <-- GET /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/context 200
9 ms - 99
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements {"
using":"id","sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48","value":"searchIn
put"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f9
50b15a2d48/elements] to [POST http://127.0.0.1:8000/wd/hub/session/d502067e81208
e7b1145ac6a73909fe0/elements] with body: {"using":"id","sessionId":"9c90d4a6-658
d-4e3a-8c87-f950b15a2d48","value":"searchInput"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":null}
[JSONWP Proxy] Replacing sessionId d502067e81208e7b1145ac6a73909fe0 with 9c90d4a
6-658d-4e3a-8c87-f950b15a2d48
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements 20
0 169 ms - 76
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements {"
using":"id","sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48","value":"searchIn
put"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f9
50b15a2d48/elements] to [POST http://127.0.0.1:8000/wd/hub/session/d502067e81208
e7b1145ac6a73909fe0/elements] with body: {"using":"id","sessionId":"9c90d4a6-658
d-4e3a-8c87-f950b15a2d48","value":"searchInput"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":[{"ELEMENT":"0.5767541529830915-1"}]}
[JSONWP Proxy] Replacing sessionId d502067e81208e7b1145ac6a73909fe0 with 9c90d4a
6-658d-4e3a-8c87-f950b15a2d48
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements 20
0 111 ms - 108
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements {"
using":"id","sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48","value":"searchIn
put"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f9
50b15a2d48/elements] to [POST http://127.0.0.1:8000/wd/hub/session/d502067e81208
e7b1145ac6a73909fe0/elements] with body: {"using":"id","sessionId":"9c90d4a6-658
d-4e3a-8c87-f950b15a2d48","value":"searchInput"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":[{"ELEMENT":"0.5767541529830915-1"}]}
[JSONWP Proxy] Replacing sessionId d502067e81208e7b1145ac6a73909fe0 with 9c90d4a
6-658d-4e3a-8c87-f950b15a2d48
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements 20
0 38 ms - 108
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/element/0.5
767541529830915-1/value {"text":"92900","sessionId":"9c90d4a6-658d-4e3a-8c87-f95
0b15a2d48","id":"0.5767541529830915-1","value":["9","2","9","0","0"]}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f9
50b15a2d48/element/0.5767541529830915-1/value] to [POST http://127.0.0.1:8000/wd
/hub/session/d502067e81208e7b1145ac6a73909fe0/element/0.5767541529830915-1/value
] with body: {"text":"92900","sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48",
"id":"0.5767541529830915-1","value":["9","2","9","0","0"]}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":null}
[JSONWP Proxy] Replacing sessionId d502067e81208e7b1145ac6a73909fe0 with 9c90d4a
6-658d-4e3a-8c87-f950b15a2d48
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/element/0.5
767541529830915-1/value 200 329 ms - 76
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/appium/devi
ce/press_keycode {"sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48","keycode":"
66"}
[debug] [MJSONWP] Calling AppiumDriver.pressKeyCode() with args: ["66",null,"9c9
0d4a6-658d-4e3a-8c87-f950b15a2d48",null,"9c90d4a6-658d-4e3a-8c87-f950b15a2d48"]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":
"pressKeyCode","params":{"keycode":"66","metastate":null}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action"
,"action":"pressKeyCode","params":{"keycode":"66","metastate":null}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: pressKeyCode
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value"
:true}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.pressKeyCode() result: true
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/appium/devi
ce/press_keycode 200 583 ms - 76
[HTTP] --> POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements {"
using":"xpath","sessionId":"9c90d4a6-658d-4e3a-8c87-f950b15a2d48","value":"//*[@
id=\"JS_searchList\"]/ul/li/a"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f9
50b15a2d48/elements] to [POST http://127.0.0.1:8000/wd/hub/session/d502067e81208
e7b1145ac6a73909fe0/elements] with body: {"using":"xpath","sessionId":"9c90d4a6-
658d-4e3a-8c87-f950b15a2d48","value":"//*[@id=\"JS_searchList\"]/ul/li/a"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d502067e81208
e7b1145ac6a73909fe0","status":0,"value":[]}
[JSONWP Proxy] Replacing sessionId d502067e81208e7b1145ac6a73909fe0 with 9c90d4a
6-658d-4e3a-8c87-f950b15a2d48
[HTTP] <-- POST /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/elements 20
0 239 ms - 74
[HTTP] --> GET /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/screenshot {
}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f95
0b15a2d48/screenshot] to [GET http://127.0.0.1:8000/wd/hub/session/d502067e81208
e7b1145ac6a73909fe0/screenshot] with body: {}
[MJSONWP] Encountered internal error running command: Error: Could not proxy. Pr
oxy error: Could not proxy command to remote server. Original error: Error: ESOC
KETTIMEDOUT
at doJwpProxy$ (../../../lib/mjsonwp/mjsonwp.js:354:13)
at tryCatch (C:\Users\016834\AppData\Roaming\npm\node_modules\appium\node_mo
dules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\016834\AppData\R
oaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js
:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\
Users\016834\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\
regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\016834\AppData\Roaming\npm\no
de_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[HTTP] <-- GET /wd/hub/session/9c90d4a6-658d-4e3a-8c87-f950b15a2d48/screenshot 5
00 240050 ms - 281
[Chromedriver] [STDERR] [604.065][SEVERE]: Timed out receiving message from rend
erer: 600.000
[Chromedriver] [STDERR] [604.065][WARNING]: screenshot failed, retrying
社区相关的帖子已经被我翻了个遍了