Unable to find WEBVIEW in an hybrid app possibly due to ios-webkit-debug-proxy

Hey guys,
Im trying to find WEBVIEW in an hybrid app but all Im getting back is NATIVE_APP. Here`s my setup:

  • xcode 10.2
  • ios 10.1
  • appium 1.6.3

TestCase:
` @Before
public void setup() {

    try {

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.6.3");
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6");
        capabilities.setCapability(MobileCapabilityType.UDID, "456af3fa1a0b67bc8f587ef5de70474dd8fc132");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.1");
        capabilities.setCapability("bundleId", "com.example");
   //     capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.example.MainActivity");
      capabilities.setCapability("autoWebview", "true");


        driver = new IOSDriver<WebElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

}`

[debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: ["3e48975f-b789-45ca-b529-06475ed400b5"] [debug] [XCUITest] Executing command 'getContexts' [debug] [iOS] Getting list of available contexts [debug] [iOS] Retrieving contexts and views [debug] [iOS] Selecting by url: false [debug] [RemoteDebugger] Getting WebKitRemoteDebugger pageArray: localhost, 27753 [debug] [RemoteDebugger] Sending request to: http://localhost:27753/json [iOS] Attempted to get a list of webview contexts but could not connect to ios-webkit-debug-proxy. If you expect to find webviews, please ensure that the proxy is running and accessible [debug] [iOS] No web frames found. [debug] [MJSONWP] Responding to client with driver.getContexts() result: ["NATIVE_APP"]

Hi @sp5594 !

did you find a solution for that Problem? i have a same issue.

best regards

Hi @FredBruder
Have you tried manually starting ios-webkit-debug-proxy (IWDP) in another terminal window before starting Appium?
In my case, a certain update caused Appium to stop “auto-starting” IWDP so my process is:

  1. open terminal window and do > ios_webkit_debug_proxy -c 91a3e160a457f41ab00f354325a4308871af63d8202:27753 -d [ the big string is your device’s UDID and the 27753 is the port for IWDP… you can test on multiple devices by changing this port number in other iterations]
  2. Start an Appium server in another terminal window with > appium --webkit-debug-proxy-port 27753 --webdriveragent-port 8200 [The first port is the one you defined in the IWDP command… the WDA port is defined for running multiple devices if necessary]
  3. Run Tests.

Good Luck!

Did you tried the below capability in your script . This will start ios-webkit-debug-proxy on default port by the appium:

capabilities.setCapability(IOSMobileCapabilityType.START_IWDP, true);

Thank you @Smitty
i allready use it, but i’ve found that my problem is in the Framework.

Thank’s @harshitj
i use startIWDP (START_IWDP was not recognized)

Can you share more details and appium logs.

Hi @harshitj,
the connection with my phone work, but it’s look like an issue with ios_webkit_debug_proxy
The Appium Logs:

[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: true (expected url: 'http://appium.io')
[debug] [RemoteDebugger] Getting WebKitRemoteDebugger pageArray: localhost, 27753
[debug] [RemoteDebugger] Sending request to: http://localhost:27753/json
[debug] [RemoteDebugger] Page element JSON: [{"devtoolsFrontendUrl":"/devtools/devtools.html?ws=localhost:27753/devtools/page/2","faviconUrl":"","thumbnailUrl":"/thumb/http://appium.io/","title":"Appium: Mobile App Automation Made Awesome.","url":"http://appium.io/","webSocketDebuggerUrl":"ws://localhost:27753/devtools/page/2","appId":"PID:3517"}]
[debug] [iOS] Picking webview 'WEBVIEW_2'
[debug] [iOS] Attempting to set context to 'WEBVIEW_2'
[debug] [RemoteDebugger] WebKit debugger web socket connected to url: ws://localhost:27753/devtools/page/2
[debug] [RemoteDebugger] Starting to listen for JavaScript console
[debug] [RemoteDebugger] Sending WebKit data: {"method":"Console.enable","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true}}
[debug] [RemoteDebugger] Webkit response timeout: 5000
[debug] [RemoteDebugger] Receiving WebKit data: '{"result":{},"id":1}'
[debug] [RemoteDebugger] Found handler for message '1'
[debug] [RemoteDebugger] WebKit debugger got a message for 'Console.enable' and have no handler, doing nothing.
[XCUITest] TimeoutError: operation timed out
[XCUITest]     at afterTimeout (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/timers.js:46:19)
[XCUITest]     at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/timers.js:76:13)
[XCUITest]     at ontimeout (timers.js:427:11)
[XCUITest]     at tryOnTimeout (timers.js:289:5)
[XCUITest]     at listOnTimeout (timers.js:252:5)
[XCUITest]     at Timer.processTimers (timers.js:212:10)
[debug] [JSONWP Proxy] Proxying [DELETE /session/4a306db4-d8fb-4456-a9c1-b74dc22b81f3] to [DELETE http://localhost:8200/session/94F3303A-33A3-4702-B6A7-0479CDB4A64B] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n\n  },\n  \"sessionId\" : \"0DC21D8E-BE6C-45FE-9F9C-346C75C5733A\",\n  \"status\" : 0\n}"
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [XCUITest] In a web session. Removing remote debugger
[debug] [RemoteDebugger] Disconnecting from WebKit remote debugger
[debug] [iOSLog] Stopping iOS log capture
[debug] [RemoteDebugger] WebKit remote debugger socket disconnected
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1530261020385 (10:30:20 GMT+0200 (CEST))
[MJSONWP] Encountered internal error running command: TimeoutError: operation timed out
[MJSONWP]     at afterTimeout (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/timers.js:46:19)
[MJSONWP]     at Timeout.timeoutTimeout [as _onTimeout] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/timers.js:76:13)
[MJSONWP]     at ontimeout (timers.js:427:11)
[MJSONWP]     at tryOnTimeout (timers.js:289:5)
[MJSONWP]     at listOnTimeout (timers.js:252:5)
[MJSONWP]     at Timer.processTimers (timers.js:212:10)
[HTTP] <-- POST /wd/hub/session 500 30391 ms - 156

Can you re-execute your scripts by adding webkitResponseTimeout capability and share logs.
capabilities.setCapability(“webkitResponseTimeout”, 70000);

There is a problem in appium 1.8.1 with Safari Browser, which is fixed in 1.8.2-beta.
I use appium@Beta and it work properly.

Thank’s for the help