在用 appium 做 iOS 混合 APP 自动化时,碰到了无法获取 webView 上下文的问题,参考社区中http://testerhome.com/topics/10951###的帖子,依然未解决问题, 仍然只能获取到 Native,麻烦大佬们给个指点

iOS 版本 15.1

Appium 版本 1.21.0

Appium 日志:

[info] [35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/7654404f-1ba4-48d3-9dd9-ecff0cf9795a/contexts[39m
[info] [35m[HTTP][39m [90m{}[39m
[debug] [35m[W3C (7654404f)][39m Calling AppiumDriver.getContexts() with args: ["7654404f-1ba4-48d3-9dd9-ecff0cf9795a"]
[debug] [35m[XCUITest][39m Executing command 'getContexts'
[debug] [35m[XCUITest][39m Getting list of available contexts
[debug] [35m[iOS][39m Retrieving contexts and views
[debug] [35m[XCUITest][39m Selecting by url: false 
[info] [35m[RemoteDebugger][39m Remote Debugger version 8.13.2
[debug] [35m[RemoteDebugger][39m useNewSafari --> false
[debug] [35m[RemoteDebugger][39m Checking which communication style to use (non-Safari on platform version '15.1')
[debug] [35m[RemoteDebugger][39m Platform version equal or higher than '12.2': true
[warn] [35m[RemoteDebugger][39m Setting communication protocol: using Target-based communication
[debug] [35m[RemoteDebugger][39m Sending connection key request
[debug] [35m[RemoteDebugger][39m Sending '_rpc_reportIdentifier:' message (id: 0): 'setConnectionKey'
[debug] [35m[RemoteDebugger][39m Sending to Web Inspector took 1ms
[debug] [35m[RemoteDebugger][39m Sending connection key request
[debug] [35m[RemoteDebugger][39m Sending '_rpc_reportIdentifier:' message (id: 2): 'setConnectionKey'
[debug] [35m[RemoteDebugger][39m Sending to Web Inspector took 1ms
[debug] [35m[RemoteDebugger][39m Selecting application
[debug] [35m[RemoteDebugger][39m No applications currently connected.
[debug] [35m[XCUITest][39m No web frames found.
[debug] [35m[W3C (7654404f)][39m Responding to client with driver.getContexts() result: ["NATIVE_APP"]
[info] [35m[HTTP][39m [37m<-- GET /wd/hub/session/7654404f-1ba4-48d3-9dd9-ecff0cf9795a/contexts [39m[32m200[39m [90m132 ms - 24[39m
[info] [35m[HTTP][39m [90m[39m
[debug] [35m[RemoteDebugger][39m Received connected automation availability state: "WIRAutomationAvailabilityNotAvailable"
[debug] [35m[RemoteDebugger][39m Received connected applications list: PID:546, PID:540, PID:2855, PID:3621
[debug] [35m[RemoteDebugger][39m Received connected driver list: {}


↙↙↙阅读原文可查看相关链接,并与作者交流