Puts available_contexts returns only native_app (iOS)


EDIT: Adding logging
Here is the GET from debugger while inspecting the element.
info: [debug] Responding to client with success: {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_1”],“sessionId”:“8fc45325-b279-495c-af71-f55f51f3482d”}
info: ← GET /wd/hub/session/8fc45325-b279-495c-af71-f55f51f3482d/contexts 200 3.484 ms - 98 {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_1”],“sessionId”:“8fc45325-b279-495c-af71-f55f51f3482d”}

Here is the GET from debugger while running the actual test
info: → GET /wd/hub/session/e8310d71-e8e7-41ed-ac39-7de7f9316e62/context {}
info: [debug] Responding to client with success: {“status”:0,“value”:“NATIVE_APP”,“sessionId”:“e8310d71-e8e7-41ed-ac39-7de7f9316e62”}
info: ← GET /wd/hub/session/e8310d71-e8e7-41ed-ac39-7de7f9316e62/context 200 0.686 ms - 84 {“status”:0,“value”:“NATIVE_APP”,“sessionId”:“e8310d71-e8e7-41ed-ac39-7de7f9316e62”}

Why isn’t the WEBVIEW_1 available once I run the actual test?

Original post:
I’m trying to test my webview application, I cannot seem to detect the webview or webview_1.
Using Appium inspector I can see the webview_1.

When I run the test and try to print out my contexts It’s only printing out NATIVE_APP.

puts available_contexts


I am expecting:


capabilities =  {
    'appium-version' => '1.0',
    platformName: 'iOS',
    deviceName: "iPhone 4s",
    platformVersion: '7.1',
    app: 'myapp_path',
    autoLaunch: true,
    newCommandTimeout: 300,
    authWebView: true,
    autoAcceptAlerts: true,
    setWebContentsDebuggingEnabled: true,
    locationServicesEnabled:  true, 
    locationServicesAuthorized: true,
    bundleId: 'com.mybundle'

Appium::Driver.new(caps: capabilities).start_driver
Appium.promote_appium_methods Object

I’ve tried to set_context(“WEBVIEW”) and set_context(“WEBVIEW_1”) without any luck, the css selector isnt supported.

Hope I’ve provided enough info.


Do I need to some how ‘refresh’ the available contexts ? When I refresh the inspector I see the webview_1.

Checking our other application it’s showing ‘WEBVIEW_1’ 2, 3, 4, 5, 6, 7, 8’ but this app only shows one view in the inspector but appium can’t actually find it??

I don’t know about css selector, however I use the following capability to go to webview by default:
capabilities.setCapability(“autoWebview”, “true”);


I am having similar problem.

Set <>String> contextNames =webDriver.getContextHandles();

gives me


so even when i am on webview page, it is only showing nativeview and not showing other context such as webview or webview1.

I am using appium 1.3.1 and working on xcode 6.1 with iOS simulator 8.1, using appium client 1.7.0

Am i missing something? Someone please help.

1 Like

Sounds exactly like my issue… I thought maybe it was a ruby problem.

your getContextHandles looks like my available_contexts, and only 1 is returned… NATIVE_APP.

btw i am using java and need to get webview working on iOS 8 soon, :frowning:

Do you also see the WEBVIEW_1 when you’re using appium inspector? but it can’t see it when the test is actually running?

No i donot see any webviews in inspector, there is only no context and NATIVE_APP.

1 Like


I added logging from my inspector and the actual test case.
Hopefully if you run the same test you can see the same issue.

I believe this is a bug? I can’t actually test my app.

While inspecting the element

info: [debug] Responding to client with success: {“status”:0,“value”:[“NATIVE_APP”],“sessionId”:“3d750d1e-d6f2-4cef-9d73-a820d60561d7”}
info: e
[37m<-- GET /wd/hub/session/3d750d1e-d6f2-4cef-9d73-a820d60561d7/contexts 200 3.927 ms - 86 {“status”:0,“value”:[“NATIVE_APP”],“sessionId”:“3d750d1e-d6f2-4cef-9d73-a820d60561d7”}

Same issue with me ? Any Solutions?

Nothing yet, maybe I should open a bug with them?

Which language are you using? I’m using Ruby, desi_chora used Java.

I am using Java @william

any one else knows solution or having same problem? Please help.

any of you guys figured it out, what was the issue?

Still trying to find a work around.

I’m using Python and I have the same problem. Only could see native_app

1 Like

I have tried in java as well as Ruby but still same issue.
When I have added capability “autoWebview = true”, then I can see all web objects as native elements.

now in appium 1.4.8

This problem still exists

Hi friends,

just rebuilt the application by adding this line webview.setEnabled(true);
now, it will show both NATIVE APP and WEBVIEW in hybrid android app