Can't switch context to webview

I believe java libraries have this issue , however I recently saw python client libraries show all contexts in robust way

do you know which libraries are required for it ?

  • Even i am facing the same problem.i am using android version 6.0.1 and appium version 1.4.16.1.But driver.context() method is failing to switch to webview.I have added chromedriverHandler().jar but still facing the problem.

switching to webview is working only for few times.In remaining all the cases it fails to switch.Any answers could be helpful

Context switching is happening only at few times.Consistency is not there.what could be the solution?

Go to Safari>Advanced>WebInspector>ON
Should work.

Even i am facing same issue , Please let me know if any solution.

Even I am facing the same issue using java.When I tried to switch to webview ,I am getting the context as undefined.Some times it is printing webview context as "WEBVIEW_undefined "and some times “WEBVIEW_XXXXX”.Can any one please help me how to resolve it.

I am still facing same issue with Appium Java Client 4.1.2 and Appium @1.6.5 for IOS

[debug] [XCUITest] Executing command ‘setContext’
[debug] [iOS] Attempting to set context to ‘WEBVIEW_1’
[HTTP] <-- POST /wd/hub/session/bb96e125-75f3-4df1-8859-60692ebe7ac3/context 500 3 ms - 109
[HTTP] --> GET /wd/hub/session/bb96e125-75f3-4df1-8859-60692ebe7ac3/contexts {}
[debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: [“bb96e125-75f3-4df1-8859-60692ebe7ac3”]
[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
[debug] [RemoteDebugger] Page element JSON: []
[debug] [iOS] No web frames found.
[debug] [MJSONWP] Responding to client with driver.getContexts() result: [“NATIVE_APP”]
[HTTP] <-- GET /wd/hub/session/bb96e125-75f3-4df1-8859-60692ebe7ac3/contexts 200 15 ms - 86
[HTTP] --> GET /wd/hub/session/bb96e125-75f3-4df1-8859-60692ebe7ac3/screenshot {}
[debug] [MJSONWP] Calling AppiumDriver.getScreenshot() with args: [“bb96e125-75f3-4df1-8859-60692ebe7ac3”]
[debug] [XCUITest] Executing command ‘getScreenshot’
[debug] [JSONWP Proxy] Proxying [GET /screenshot] to [GET http://localhost:8100/session/7C9D2E75-E54E-466C-A4F0-C37546B7EF53/screenshot] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n “value” : "iVBORw0KGgoAAAANSUhEUgAABNoAAAigCAYAAADpkk+ZAAAAAXNSR0IArs4c6QAA\r\nABxpRE9UAAAAAgAAAAAAAARQAAAAKAAABFAAAARQAAHszMNSqAcAAEAASURBVHgB\r\n7J0H2BxVvf9BBQvYrwW8Vy5Fr4oFFP2rKOpVxIJ6LaiAIiA2BBtiAyWEAAkQSihJ\r\nqAlJSO8QIJRASCWNhBBCOoTeewkk5z/fiWdz9uzM7Mzu7O7s7ud9nveZsnPa73xm\r\nzpnv/M45Wz3//AuGf2wAAzAAAzAAAzAAAzAAAzAAAzAAAzAAAzAAA/UxsBUGrM+A\r\n2A/7wQAMwAAMwAAMwAAMwAAMwAAMwAAMwAAMiAGENjz68GiEARiAARiAARiAARiA\r\nARiAARiAARiAARjIgQGEthyMiGqNag0DMAADMAADMAADMAADMAADMAADMAADMIDQ\r\nhtCGYg0DMAADMAADMAADMAADMAADMAADMAADMJADAwhtORgRxRrFGgZgAAZgAAZg\r\nAAZgAAZgAAZgAAZgAAZgAKENoQ3FGgZgAAZgAAZgAAZgAAZgAAZgAAZgAAZg4PkX\r\nAxtU+08WExHauJG4kWAABmAABmAABmAABmAABmAABmAABmCgwxiQYJYsipX/Xk1g\r\n83+PjhuhLZPRo41YXjFcgz1gAAZgAAZgAAZgAAZgAAZgAAZgAAZgoHUMuKJYmnpw\r\nr8+yXxk3QhtCW0aFtxKi1t045AXbwwAMwAAMwAAMwAAMwAAMwAAMwAAMuAxECWXu\r\n7/5+1PVZzpXHh9CG0IbQBgMwAAMwAAMwAAMwAAMwAAMwAAMwAAMdwECSQFYuiG0R\r\nJ5PCpPmtPF6ENm6kDriRyqHecrNwHlvAAAzAAAzAAAzAAAzAAAzAAAzAQHcwkF0U\r\n22yXN…
[debug] [MJSONWP] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAABNoAAAigCAYAAADpkk+ZAAAAAXNSR0IArs4c6QAA\r\nABxpRE9UAAAAAgAAAAAAAARQAAAAKAAABFAAAARQAAHszMNSqAcAAEAASURBVHgB\r\n7J0H2BxVvf9BBQvYrwW8Vy5Fr4oFFP2rKOpVxIJ6LaiAIiA2BBtiAyWEAAkQSihJ\r\nqAlJSO8QIJRASCWNhBBCOoTeewkk5z/fiWdz9uzM7Mzu7O7s7ud9nveZsnPa73xm\r\nzpnv/M45Wz3//AuGf2wAAzAAAzAAAzAAAzAAAzAAAzAAAzAAAzAAA/UxsBUGrM+A\r\n2A/7wQAMwAAMwAAMwAAMwAAMwAAMwAAMwAAMiAGENjz68GiEARiAARiAARiAARiA\r\nARiAARiAARiAARjIgQGEthyMiGqNag0DMAADMAADMAADMAADMAADMAADMAADMIDQ\r\nhtCGYg0DMAADMAADMAADMAADMAADMAADMAADMJADAwhtORgRxRrFGgZgAAZgAAZg\r\nAAZgAAZgAAZgAAZgAAZgAKENoQ3FGgZgAAZgAAZgAAZgAAZgAAZgAAZgAAZg4PkX\r\nAxtU+08WExHauJG4kWAABmAABmAABmAABmAABmAABmAABmCgwxiQYJYsipX/Xk1g\r\n83+PjhuhLZPRo41YXjFcgz1gAAZgAAZgAAZgAAZgAAZgAAZgAAZgoHUMuKJYmnpw\r\nr8+yXxk3QhtCW0aFtxKi1t045AXbwwAMwAAMwAAMwAAMwAAMwAAMwAAMuAxECWXu\r\n7/5+1PVZzpXHh9CG0IbQBgMwAAMwAAMwAAMwAAMwAAMwAAMwAAMdwECSQFYuiG0R\r\nJ5PCpPmtPF6ENm6kDriRyqHecrNwHlvAAAzAAAzAAAzAAAzAAAzAAAzAQHcwkF0U\r\n22yXNOGSrinnC6ENoQ2hDQZgAAZgAAZgAAZgAAZgAAZgAAZgAAbamIEkIcz9rVwU\r\n…

This discussion was long time ago, but I have the same problem with the latest Appium 1.21.0. I can get the list using getContextHandles():
[“NATIVE_APP”,“WEBVIEW_XX.XXXXX.XXXX”]
But when I switch to webview using getDriver().context(WEBVIEW_XX.XXXXX.XXXX), it throws exception from time to time. This line of code is very unstable.
I was surprised that this problem wasn’t resolved.

I still having same issue in Android real devices, no updates so far?