关于 ios 上,appium inspector 不能识别 webview 页面的问题

1.现象
在 ios 平台上,我用 appium inspector 打开测试 app 的 webview 页面,在 context 项下没有显示 webview 和 native context,只显示一个 no context


2.调试

脚本中使用 driver.getCurrentContext() 返回 result: "NATIVE_APP",尝试过在两次 getCurrentContext 之间做一次 setContext() 到 webview,结果报错,前后两次的 getCurrentContext() 返回 result: "NATIVE_APP"。

报错 log 如下:
alling AppiumDriver.setContext() with args: ["WEBVIEW_com.XXXXXXXXX.activity","1aae4c3f-469f-4d9a-b4a2-0ab05e758d04"] 2016-05-25 10:11:03:121 - [MJSONWP] Encountered internal error running command: RequestError: Error: connect ECONNREFUSED 127.0.0.1:27753 at new RequestError (/usr/local/lib/node_modules/appium/node_modules/request-promise/lib/errors.js:11:15) at Request.RP$callback [as callback] (/usr/local/lib/node_modules/appium/node_modules/request-promise/lib/rp.js:60:32) at self.callback (/usr/local/lib/node_modules/appium/node_modules/request-promise/node_modules/request/request.js:199:22) at emitOne (events.js:90:13) at Request.emit (events.js:182:7) at Request.onRequestError (/usr/local/lib/node_modules/appium/node_modules/request-promise/node_modules/request/request.js:821:8) at emitOne (events.js:90:13) at ClientRequest.emit (events.js:182:7) at Socket.socketErrorListener (http_client.js:306:9) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7) at emitErrorNT (net.js:1249:8) at combinedTickCallback (internal/process/next_tick.js:74:11) at process.tickCallback (internal/process/next_tick.js:98:9) 2016-05-25 10:11:03:124 - [HTTP] <-- POST /wd/hub/session/1aae4c3f-469f-4d9a-b4a2-0ab05e758d04/context 500 23 ms - 214


3.问题:

在 android app 上,开发同学需要在代码中加一句 setWebContentsDebuggingEnabled 的 WebView 类的静态方法,那么在 ios 上是否也有类似的要求?谢谢。


4.截图


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