Appium appium 混合 APP,x5 内核,webview 切换报错

老二 · 2018年01月23日 · 最后由 Ou Bowu 回复于 2018年11月16日 · 3210 次阅读

前言:15 号左右,开发和我说搞了一个高逼格的东西,亲儿子换成 QQx5 的内核了,然后我这边发现____以前可以直接定位的,现在更换 x5 内核之后 H5 页面的元素竟然 switch_to.context 切换不了!

环境:
语言 :python3.52
appium :1.6.3
pc 谷歌 :62.xxx
手机谷歌:62:xxx ()
chromedriver:2.34

print(self.driver.contexts) # 打印出来下面有多个 webview,另外腾讯的 webview 有时候打印不出来!
['NATIVE_APP', 'WEBVIEW_com.henji.yunyi.yizhibang:channel', 'WEBVIEW_com.henji.yunyi.yizhibang', 'WEBVIEW_com.henji.yunyi.yizhibang:ipc', 'WEBVIEW_io.rong.push']

启动项: 这里加了这两个


报错及问题:
目前切换 webview 的时候,会一直卡在哪里,直到报错,目前我切换的 webview 是: 'WEBVIEW_com.henji.yunyi.yizhibang'
Appium 日志如下:
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_io.rong.push","WEBVIEW_com.hen
ji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WEBVIEW_com.henji.y
unyi.yizhibang:channel"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_io.rong.push"
,"WEBVIEW_com.henji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WE
BVIEW_com.henji.yunyi.yizhibang:channel"]
[debug] [MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/context 200
954 ms - 76
[HTTP] --> GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/context {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentContext() with args: ["932489f4
-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: "
NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/context 200
5 ms - 84
[HTTP] --> POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/element {"v
alue":"com.henji.yunyi.yizhibang:id/iv_brand_preview","sessionId":"932489f4-c0dc
-45c7-aec1-b9a5e5be4039","using":"id"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.henji
.yunyi.yizhibang:id/iv_brand_preview","932489f4-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 10000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8214/w
d/hub/session/5a77cb50-d4aa-45ee-bee3-43614306b457/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/iv_brand_preview","context":"",
"multiple":false}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"5a77cb50-d4aa
-45ee-bee3-43614306b457","status":0,"value":{"ELEMENT":"d205a111-5fc1-4221-bf89-
96f10ba1c4af"}}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEME
NT":"d205a111-5fc1-4221-bf89-96f10ba1c4af"}
[HTTP] <-- POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/element 200
61 ms - 122
[HTTP] --> POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/element/d20
5a111-5fc1-4221-bf89-96f10ba1c4af/click {"id":"d205a111-5fc1-4221-bf89-96f10ba1c
4af","sessionId":"932489f4-c0dc-45c7-aec1-b9a5e5be4039"}
[debug] [MJSONWP] Calling AppiumDriver.click() with args: ["d205a111-5fc1-4221-b
f89-96f10ba1c4af","932489f4-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [JSONWP Proxy] Proxying [POST /element/d205a111-5fc1-4221-bf89-96f10ba1c
4af/click] to [POST http://localhost:8214/wd/hub/session/5a77cb50-d4aa-45ee-bee3
-43614306b457/element/d205a111-5fc1-4221-bf89-96f10ba1c4af/click] with body: {"e
lementId":"d205a111-5fc1-4221-bf89-96f10ba1c4af"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"5a77cb50-d4aa
-45ee-bee3-43614306b457","status":0,"value":true}
[debug] [MJSONWP] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/element/d20
5a111-5fc1-4221-bf89-96f10ba1c4af/click 200 33 ms - 76
[HTTP] --> GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/appium/devic
e/current_activity {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentActivity() with args: ["932489f
4-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","dumpsys","window","windows
"]
[debug] [MJSONWP] Responding to client with driver.getCurrentActivity() result:
".promotion.brand.activity.PreviewBrandActivity"
[HTTP] <-- GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/appium/devic
e/current_activity 200 287 ms - 120
[HTTP] --> GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/appium/devic
e/current_activity {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentActivity() with args: ["932489f
4-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [ADB] Getting focused package and activity
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","dumpsys","window","windows
"]
[debug] [MJSONWP] Responding to client with driver.getCurrentActivity() result:
".promotion.brand.activity.PreviewBrandActivity"
[HTTP] <-- GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/appium/devic
e/current_activity 200 332 ms - 120
[HTTP] --> GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/contexts {}
[debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: ["932489f4-c0dc-
45c7-aec1-b9a5e5be4039"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","cat","/proc/net/unix"]
[debug] [AndroidDriver] WEBVIEW_12799 mapped to pid 12799
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_12632 mapped to pid 12632
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_12779 mapped to pid 12779
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_13190 mapped to pid 13190
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [AndroidDriver] Parsed pid: 12779 pkg: com.henji.yunyi.yizhibang:ipc!
[debug] [AndroidDriver] from: u0_a216,12779,624,1203396,129172,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang:ipc
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang:ipc
[debug] [AndroidDriver] Parsed pid: 12632 pkg: com.henji.yunyi.yizhibang!
[debug] [AndroidDriver] from: u0_a216,12632,624,1540488,227184,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang
[debug] [AndroidDriver] Parsed pid: 12799 pkg: io.rong.push!
[debug] [AndroidDriver] from: u0_a216,12799,624,1199152,122136,SyS_epoll_,000000
0000,S,io.rong.push
[debug] [AndroidDriver] returning process name: io.rong.push
[debug] [AndroidDriver] Parsed pid: 13190 pkg: com.henji.yunyi.yizhibang:channel
!
[debug] [AndroidDriver] from: u0_a216,13190,624,1199040,120008,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang:channel
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang:channe
l
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_io.rong.push","WEBVIEW_com.hen
ji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WEBVIEW_com.henji.y
unyi.yizhibang:channel"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_io.rong.push"
,"WEBVIEW_com.henji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WE
BVIEW_com.henji.yunyi.yizhibang:channel"]
[debug] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIV
E_APP","WEBVIEW_io.rong.push","WEBVIEW_com.henji.yunyi.yizhibang","WEBVIEW_com.h
enji.yunyi.yizhibang:ipc","WEBVIEW_com.henji.yunyi.yizhibang:channel"]
[HTTP] <-- GET /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/contexts 200
984 ms - 229
[HTTP] --> POST /wd/hub/session/932489f4-c0dc-45c7-aec1-b9a5e5be4039/context {"n
ame":"WEBVIEW_com.henji.yunyi.yizhibang","sessionId":"932489f4-c0dc-45c7-aec1-b9
a5e5be4039"}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_com.hen
ji.yunyi.yizhibang","932489f4-c0dc-45c7-aec1-b9a5e5be4039"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","cat","/proc/net/unix"]
[debug] [AndroidDriver] WEBVIEW_12799 mapped to pid 12799
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_12632 mapped to pid 12632
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_12779 mapped to pid 12779
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [AndroidDriver] WEBVIEW_13190 mapped to pid 13190
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\tools\androidSdk\android-sdk-windows\platform-tools\ad
b.exe' with args: ["-P",5037,"-s","2905bdb6","shell","ps"]
[debug] [AndroidDriver] Parsed pid: 12779 pkg: com.henji.yunyi.yizhibang:ipc!
[debug] [AndroidDriver] from: u0_a216,12779,624,1201268,123100,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang:ipc
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang:ipc
[debug] [AndroidDriver] Parsed pid: 12632 pkg: com.henji.yunyi.yizhibang!
[debug] [AndroidDriver] from: u0_a216,12632,624,1533948,222884,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang
[debug] [AndroidDriver] Parsed pid: 12799 pkg: io.rong.push!
[debug] [AndroidDriver] from: u0_a216,12799,624,1197024,119284,SyS_epoll_,000000
0000,S,io.rong.push
[debug] [AndroidDriver] returning process name: io.rong.push
[debug] [AndroidDriver] Parsed pid: 13190 pkg: com.henji.yunyi.yizhibang:channel
!
[debug] [AndroidDriver] from: u0_a216,13190,624,1199040,120008,SyS_epoll_,000000
0000,S,com.henji.yunyi.yizhibang:channel
[debug] [AndroidDriver] returning process name: com.henji.yunyi.yizhibang:channe
l
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_io.rong.push","WEBVIEW_com.hen
ji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WEBVIEW_com.henji.y
unyi.yizhibang:channel"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_io.rong.push"
,"WEBVIEW_com.henji.yunyi.yizhibang","WEBVIEW_com.henji.yunyi.yizhibang:ipc","WE
BVIEW_com.henji.yunyi.yizhibang:channel"]
[debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_com
.henji.yunyi.yizhibang'
[debug] [AndroidDriver] A port was not given, using random port: 8000
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: C:\Users\Administrator\AppData\Roamin
g\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chro
medriver.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\Administrator\AppData\Roamin
g\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chro
medriver.exe --url-base=wd/hub --port=8000 --adb-port=5037
[Chromedriver] [STDOUT] Starting ChromeDriver 2.34.522940 (1a76f96f66e3ca7b8e57d
503b4dd3bccfba87af1) 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.henji.yunyi.yizhibang","androidUseRunningApp":true,"androidProcess":"co
m.tencent.mm:tools","androidDeviceSerial":"2905bdb6"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"f1d8bf2a72135
bd363d649849dc80995","status":100,"value":{"message":"chrome not reachable\n (D
river info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),
platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[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.henji.yunyi.yizhibang","androidUseRunningApp":true,"androidProcess":"co
m.tencent.mm:tools","androidDeviceSerial":"2905bdb6"}}}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"76c5f76390d92
78d23492f81168259e7","status":100,"value":{"message":"chrome not reachable\n (D
river info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),
platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[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.henji.yunyi.yizhibang","androidUseRunningApp":true,"androidProcess":"co
m.tencent.mm:tools","androidDeviceSerial":"2905bdb6"}}}
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 3957 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 4494 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 5036 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 5582 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 6340 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 6885 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 7427 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 7963 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 8557 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[debug] [BaseDriver] Waited for 9508 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_tips_dialog_confirm","conte
xt":"","multiple":false}
[HTTP] <-- POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element 500
10343 ms - 164
[HTTP] --> POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element {"v
alue":"com.henji.yunyi.yizhibang:id/tv_back","using":"id","sessionId":"eb05cdde-
12d7-4088-a211-72ab12abde60"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.henji
.yunyi.yizhibang:id/tv_back","eb05cdde-12d7-4088-a211-72ab12abde60"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 10000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 35 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 658 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 1201 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 1741 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 2286 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 2823 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 3490 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 4023 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 4565 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 5095 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 5666 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 6202 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 6738 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 7502 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 8041 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 8583 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 9129 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[debug] [BaseDriver] Waited for 9673 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/tv_back","context":"","multiple
":false}
[HTTP] <-- POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element 500
10220 ms - 164
[HTTP] --> POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element {"v
alue":"com.henji.yunyi.yizhibang:id/rl_home_mine","using":"id","sessionId":"eb05
cdde-12d7-4088-a211-72ab12abde60"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.henji
.yunyi.yizhibang:id/rl_home_mine","eb05cdde-12d7-4088-a211-72ab12abde60"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 10000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/rl_home_mine","context":"","mul
tiple":false}
[debug] [BaseDriver] Waited for 37 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/rl_home_mine","context":"","mul
tiple":false}
[debug] [BaseDriver] Waited for 8785 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/rl_home_mine","context":"","mul
tiple":false}
[debug] [BaseDriver] Waited for 9329 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/rl_home_mine","context":"","mul
tiple":false}
[debug] [BaseDriver] Waited for 9957 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/rl_home_mine","context":"","mul
tiple":false}
[HTTP] <-- POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element 500
10519 ms - 164
[HTTP] --> POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element {"v
alue":"com.henji.yunyi.yizhibang:id/btn_login_submit","using":"id","sessionId":"
eb05cdde-12d7-4088-a211-72ab12abde60"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.henji
.yunyi.yizhibang:id/btn_login_submit","eb05cdde-12d7-4088-a211-72ab12abde60"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class
name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 10000 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 37 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 930 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 1762 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 2301 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 2933 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 3468 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 4009 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 4545 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 5077 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 5768 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 6301 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 6939 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 7486 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 8030 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 8568 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 9101 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[debug] [BaseDriver] Waited for 9778 ms so far
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8215/w
d/hub/session/cca71bf8-7b2b-4d2d-b234-3e9666877bb6/element] with body: {"strateg
y":"id","selector":"com.henji.yunyi.yizhibang:id/btn_login_submit","context":"",
"multiple":false}
[HTTP] <-- POST /wd/hub/session/eb05cdde-12d7-4088-a211-72ab12abde60/element 500
10344 ms - 164

pychram 编译器报错:

目前自己怀疑是不是 webview 的版本是 57,我这边需要更换 chromedriver 与 57 匹配!有大神能帮忙看下吗!

共收到 11 条回复 时间 点赞

OK,这个切换的问题目前已经自己解决了!

老二 回复

可以分享下你的解决方案?

看下打印出来的日志对应的浏览器版本和 chromedriver 是不是对的上,我出现的就是这个问题。网上搜索下 chromedriver 对应版本,替换 appium 安装目录

@Von_fan 大哥 你是怎么成功的 我也遇到这个问题了

宣梦达 Appium1.7.2 android toast 消息测试 中提及了此贴 03月21日 17:11

大哥,你的解决方案呢?

能通过 xpath 的方式找到 x5 WebView 的元素吗?我的原生 WebView 能,但换成 x5 WebView 就找不到了

老二 回复

可以分享下你的解决方案?

老二 回复

可以分享下你的解决方案?

老二 回复

我用 java,如你配置 androidProcess
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("androidProcess", "com.tencent.mm:tools");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

为何就出错,根本不执行了?

又不是测微信的 webview,设置"androidProcess", "com.tencent.mm:tools” 是没用的,建议看下官方文档http://chromedriver.chromium.org/getting-started/getting-started---android
特别注意需要设置 androidActivity。
x5 内核 webview 测试关键点:1)x5 是否开启 tbs inspector,

2)chromedriver 版本是否正确(目前 4.2 版本基于 chrome57,对应 chromedriver 2.29)
3)chromeOptions 设置是否正确
顺便吐槽下楼主,解决了你倒是写下解决方案啊!!

老二 回复

能给个解决办法吗 我卡在这里 老二兄

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