Appium only show native app context, is does not recognises the webview context for android app

Are you sure you are using the correct Appium version, as your log mentions that you are using version 1.1.0 of the Appium server.

I recommend updating to the latest Appium version and trying again as old Appium versions starting from 1.1 were using an older bundled version of Selendroid that has been known to cause Showstopper issues when starting the server and signing the app.

java version “1.8.0_25” Java™ SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot™ 64-Bit Server VM (build 25.25-b02, mixed mode)

Appium 1.3.4.1

Android SDK ro.build.version.sdk=21…

Device used :- Nexus 7, 5.0.2

Hi,

I am using following code to get textual data from android.webkit.webview, but i m failing. Please help me .

Code used :- List L1=(By.id(“com.zimbra.client.zimbox:id/conversation_WebView”)); List L2=(By.className(“android.webkit.WebView”));

L1.get(index).gettext() is not returning me text.

Earlier we implemented some appium test for a webview. All was working. When we revisit it recently, it stopped working and we got exactly same issue. But we haven’t changed anything related to the test. The configurations are all the same and the Appium version is 1.3.7.

The only thing we can think of is we did update the Android SDK to API 22. But after we downgrade it to API 21, it still behave the same. Does any body know what might be the problem?

Another thing, the issue only occurs on the emulator (no matter which), but it works on the device.

For me its not working on both emulator and real device for android. What about the API level 19 is it working fine for u guys. For API level 19 also the webdebuggingcontent should be true?.

No everything under API 21 is not working. And the last answer yes

I have The same problem with Appium 1.3.7, Selenium-java-2.45.0.jar, java-client-1.5.0.jar

For me it happens on different Android devices randomly…

Sometimes fresh install of the app on the device and putting the same app in the test projects Application folder works. sometimes just renaming the app works. But nothing consistent.

I still can’t find a pattern when the AppiumDriver finds the WEBVIEW context and when it doiesn’t.

It seems it is an old issue and has no fix yet?

Thanks for any help.

A

It seems if we put a very long wait before switching the context, the webview context will appear. But it really takes ages, up to two three minutes on devices.

1 Like

What works for me is to install the app on the phone first and run it once, only after that run the test.
Thats the case with Samsung S4 at least.

+1, happens also on iOS, related to:

Seems to be solved in Appium 1.4.3 https://github.com/appium/appium/issues/5222

I encountered the same before. so I already gave up util they have a better build.

Hi friends

just rebuilt the apk by adding below line to enable the Webview in the apk .

webview.setEnabled(true);

Now,it will list both Native and WebView for HybridAndroid App

hi please tell me clearly where i should modify, which file in the app and location
please help me ASAP

hi sorry for late rply.

WebView.SetWebContentsDebuggingEnable(true); in the CordovaWebview.java file .

Hi Antony,

The above property mentioned, the app which I am automating is using third party’s web view HTML page which is used for payment options, so this property setting true or false in not under our control, this is what the statement I heard by my Dev team, could you please suggests any other way to do it, I have completely blocked with this.

1 Like

hi githubramakrishnan,
i am also facing same problem. but i am using ionic framework how can i enable WebView.SetWebContentsDebuggingEnable(true); there is no java like CordovaWebview.java file .

hi githubramakrishnan can you explain me how to add the single line code in apk file(ionic hybrid app)

1 Like

Hi Sumumar_m did you got any update on it or can anyone please help me how can i get WEBVIEW for application implemented in Ionic framework in crosswalk I tried the patch but even that time it is not able to identifies element using xpath.

I am using APPIUM -v 1.5.3
Tried Patch given in “https://github.com/ITKarel/ChromeDriver

ISSUE:
Still not able to view Webview, I am able to click on ID (With APPIUM version 1.6 without patch )as ID is also there in NATIVE_APP but while trying to click using xPath I am not able to do that as I am not able to get WEBVIEW for that application using APPIUM.

Appreciate your help

Hi Guys

Can you please guide how to set webview enabled=true in IONIC2 Framewrok from developer side. To get everywhere web view whenever context view change from automation in running time.

can you anyone help on this appium inspector keep on loading

ib\commands\general.js:107:7)
[AndroidUiautomator2Driver@efd6 (ba7e1807)] at AndroidUiautomator2Driver.getWindowRect (C:\Users\vinit.appium\node_modules\appium-uiautomator2-driver\lib\commands\general.js:117:29)
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/window/rect 500 17 ms - 938
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/source
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Driver proxy active, passing request on via HTTP proxy
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Matched ‘/session/ba7e1807-98af-4b91-8fac-c90e2f59f751/source’ to command name ‘getPageSource’
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Proxying [GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/source] to [GET http://127.0.0.1:8200/session/12a03e35-9c01-4a59-8a75-789278fec630/source] with no body
[AndroidUiautomator2Driver@efd6 (ba7e1807)] socket hang up
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/source 400 15 ms - 1123
[HTTP]
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 200 5 ms - 42
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 8 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 6 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 6 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 6 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 1 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 1 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 3 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 4 ms - -
[HTTP]
[HTTP] --> GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts
[HTTP] {}
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Calling AppiumDriver.getTimeouts() with args: [“ba7e1807-98af-4b91-8fac-c90e2f59f751”]
[AndroidUiautomator2Driver@efd6 (ba7e1807)] Responding to client with driver.getTimeouts() result: {“command”:3600000,“implicit”:0}
[HTTP] <-- GET /session/ba7e1807-98af-4b91-8fac-c90e2f59f751/timeouts 304 2 ms - -