【 iOS 】获取 Hybrid 页面元素时,发现找不到元素。通过打印日志发现,获取到的 driver 只有 Native,没有 WebDriver
- Macaca Version: 2.1.3
- Operate System: macOS 10.13.6
- Programming Language: js
在 iOS 设备 Safari 浏览器中,获取 WebView 页面元素时,发现定位不到元素。通过打印日志发现,获取到的 driver 只有 NATIVE_APP,没有 WebDriver,提示 『'Cannot find any Webview'』
- Case 说明:
- iOS 设备 Safari 浏览器中,打开 WebView 页面
- 查找页面中的元素,并进行操作
-
Case Demo:

-
Case结果: Logs 输出 :contexts: ["NATIVE_APP"],没有 webview
@xudafeng 求支持
This is the translated issue:
[ios] When I get a Hybrid page element, I found that I could not find the element. By printing the log, the driver obtained is only native, no WebDriver
- Macaca Version: 2.1.3
- Operate System: macOS 10.13.6
- Programming Language: js
[ios] When I get a Hybrid page element, I found that I could not find the element. By printing the log, the driver obtained is only native, there is no WebDriver, and the prompt "'Cannot find any Webview'"
我也遇到同样的问题,现在无法操作ios webview,已经找了很久的问题了,还没有解决,求回复
This is the translated issue comment: @zyq198764
I also encountered the same problem, can not operate ios webview now, has been looking for a long time, and has not resolved, ask for a reply
macaca doctor?
+1
在 webview 页面获取 contexts 时日志如下:
responseHandler.js:49:14 [master] pid:8508 Send HTTP Respone to Client[2019-01-21 13:45:16]: {"sessionId":"7a2aa959-5aa3-4bf2-9066-285c9910fb1b","status":0,"value":"{"platformName":"iOS","deviceName":"UITest-simulator","bundleId":"com.xxxx.xxxx"}"} responseHandler.js:11:12 [master] pid:8508 Recieve HTTP Request from Client[2019-01-21 13:47:27]: method: GET url: /wd/hub/session/7a2aa959-5aa3-4bf2-9066-285c9910fb1b/contexts, jsonBody: {} ios_webkit_debug_proxy path: /usr/local/bin/ios_webkit_debug_proxy remote-debugger.js:47:18 [master] pid:8508 Device: SIMULATOR does not exist. remote-debugger.js:65:12 [master] pid:8508 Getting pages from url: http://localhost:9221/json macaca-ios.js:449:12 [master] pid:8508 Cannot find any Webview responseHandler.js:49:14 [master] pid:8508 Send HTTP Respone to Client[2019-01-21 13:47:28]: {"sessionId":"7a2aa959-5aa3-4bf2-9066-285c9910fb1b","status":0,"value":"["NATIVE_APP"]"}
单独试了下 ios_webkit_debug_proxy,获取到的 http://localhost:9221/json 为空(https://github.com/google/ios-webkit-debug-proxy#can-not-see-simulator 已确保这几项都按文档操作了)
看到 IWDP 也有类似的 issue https://github.com/google/ios-webkit-debug-proxy/issues/250
This is the translated issue comment: @louiseyang
+1
The logs when getting contexts on the webview page are as follows:
responseHandler.js:49:14 [master] pid:8508 Send HTTP Respone to Client[2019-01-21 13:45:16]: {"sessionId":"7a2aa959-5aa3-4bf2-9066-285c9910fb1b", "status":0,"value":"{"platformName":"iOS","deviceName":"UITest-simulator","bundleId":"com.xxxx. Xxxx"}"} responseHandler.js:11:12 [master] pid:8508 Recieve HTTP Request from Client[2019-01-21 13:47:27]: method: GET url: /wd/hub/session/7a2aa959-5aa3-4bf2 -9066-285c9910fb1b/contexts, jsonBody: {} Ios_webkit_debug_proxy path: /usr/local/bin/ios_webkit_debug_proxy remote-debugger.js:47:18 [master] pid:8508 Device: SIMULATOR does not exist. remote-debugger.js:65:12 [master] pid:8508 Getting pages from url: http://localhost:9221/json macaca-ios.js:449:12 [master] pid:8508 Cannot find any Webview responseHandler.js:49:14 [master] pid:8508 Send HTTP Respone to Client[2019-01-21 13:47:28]: {"sessionId":"7a2aa959-5aa3-4bf2-9066-285c9910fb1b", "status": 0, "value": "["NATIVE_APP"]"}
I tried ios_webkit_debug_proxy separately and got http://localhost:9221/json empty (https://github.com/google/ios-webkit-debug-proxy#can-not-see-simulator Items are manipulated by document)
I see a similar issue with IWDP https://github.com/google/ios-webkit-debug-proxy/issues/250
等近期的一个更新 https://github.com/macacajs/node-ios-webkit-debug-proxy/pull/5/files
This is the translated issue comment: @xudafeng
Such as a recent update https://github.com/macacajs/node-ios-webkit-debug-proxy/pull/5/files