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

Thanks a lot @Hassan_Radi … I need a other help from yourside .

When i use Selendroid mode with Appium version 1.3.4 and with selendroid port as 8080, then i am getting the following error .

I dont have any port running with 8080.
My app has a INTERNET persmission in the manifest file as well…

Can you please throw some light and help me on this issue. I have been struggling hard for the past 2 days.

info: Welcome to Appium v1.1.0 (REV e433bbc31511f199287db7724e1ce692bcb32117)

info: Appium REST http interface listener started on 0.0.0.0:4723
info: socket.io started
info: Non-default server args: {“app”:"/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk",“androidPackage”:“com.myntra.android”,“androidActivity”:“com.myntra.android.activities.LoginRegisterActivity”,“deviceName”:“Emulator”,“platformName”:“Android”,“platformVersion”:“4.2”,“automationName”:“Selendroid”,“defaultCommandTimeout”:7200}

info: Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.1.0”,“revision”:“e433bbc31511f199287db7724e1ce692bcb32117”}}}

debug: Appium request initiated at /wd/hub/status

GET /wd/hub/status 200 6ms - 143b

debug: Request received with params: {}

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.1.0”,“revision”:“e433bbc31511f199287db7724e1ce692bcb32117”}}}

debug: Request received with params: {}

GET /wd/hub/status 200 1ms - 143b

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.1.0”,“revision”:“e433bbc31511f199287db7724e1ce692bcb32117”}}}

debug: Request received with params: {}
debug: Appium request initiated at /wd/hub/sessions
debug: Request received with params: {}
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“4.2”,“newCommandTimeout”:“999999”,“automationName”:“Selendroid”,“deviceName”:“Emulator”}}
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” devices
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 wait-for-device
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “echo ‘ready’”
debug: Checking app cert for /tmp/selendroid.com.myntra.android.apk: java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/helpers/verify.jar” “/tmp/selendroid.com.myntra.android.apk”
debug: Checking app cert for /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk: java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/helpers/verify.jar” “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk”
debug: App already signed.
debug: zipAlignApk: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign” -f 4 “/tmp/selendroid.com.myntra.android.apk” “/var/folders/y8/v8mswzvj24q92_y6tzb94yysqm0c7g/T/appium115112-48835-d234v5.tmp”
debug: App already signed.
debug: zipAlignApk: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign” -f 4 “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk” “/var/folders/y8/v8mswzvj24q92_y6tzb94yysqm0c7g/T/appium115112-48835-qlpbd8.tmp”
debug: Getting install status for com.myntra.android.selendroid
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “pm list packages -3 com.myntra.android.selendroid”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “getprop persist.sys.language”
debug: Current device language: en
debug: java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/helpers/strings_from_apk.jar” “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk” “/tmp/com.myntra.android” en
debug: java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/helpers/strings_from_apk.jar” “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk” “/tmp/com.myntra.android”
debug: Exception in thread “main” brut.androlib.AndrolibException: Could not decode arsc file
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
at strings.StringsXML.run(StringsXML.java:84)
at strings.StringsXML.main(StringsXML.java:151)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
… 5 more

debug: Not uninstalling app since server not started with --full-reset
debug: Checking app cert for /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk: java -jar “/Applications/Appium.app/C
GET /wd/hub/status 200 0ms - 143b
info: Responding to client with success: {“status”:0,“value”:[]}
GET /wd/hub/sessions 200 1ms - 32b
info: Using local app from command line: /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk
info: Creating new appium session 263f0537-9cdd-492f-b974-ca0820243c1c
info: Starting selendroid server
info: Checking whether selendroid is built yet
info: Selendroid server exists!
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from /Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb
info: Trying to find a connected android device
info: [ADB] Getting connected devices…
info: [ADB] 1 device(s) connected
info: Setting device id to 4d0061964e7f3177
info: [ADB] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: Starting logcat capture
info: Rebuilt selendroid apk exists, doing nothing
info: Rebuilt selendroid server already exists, no need to rebuild it with a new manifest
info: Checking signed status of /tmp/selendroid.com.myntra.android.apk
info: Checking signed status of /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk
info: Zip-aligning /tmp/selendroid.com.myntra.android.apk
info: Checking whether zipalign is present
info: [ADB] Using zipalign from /Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign
info: Zip-aligning /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk
info: Checking whether zipalign is present
info: [ADB] Using zipalign from /Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign
info: [ADB] App is installed
info: Rebuilt selendroid is already installed
info: No strings.xml for language ‘en’, getting default strings.xml
warn: Error getting strings.xml from apk
info: Zip-aligning /Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk
info: Checking whether zipalign is present
info: [ADB] Using zipalign from /Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign
info: MD5 for app is 396704003712edcec12bc62efd3f16f4
info: [ADB] App is not installed
info: Removing any old apks
info: Uninstalling com.myntra.android
info: [ADB] Forwarding system:8080 to device:8080
info: Writing dumpsys output to /Applications/Appium.app/Contents/Resources/node_modules/appium/.dumpsys.log
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info:
ontents/Resources/node_modules/appium/lib/devices/android/helpers/verify.jar” “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk”
debug: App already signed.
debug: zipAlignApk: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.0.1/zipalign” -f 4 “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk” “/var/folders/y8/v8mswzvj24q92_y6tzb94yysqm0c7g/T/appium115112-48835-d2yzo1.tmp”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “ls /data/local/tmp/396704003712edcec12bc62efd3f16f4.apk”
debug: Getting install status for com.myntra.android
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “pm list packages -3 com.myntra.android”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “mkdir -p /data/local/tmp/”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “ls /data/local/tmp/*.apk”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell rm “/data/local/tmp/15a486aac1cbb34b9465c67d4cbd2de4.apk”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 push “/Users/c.sivasubramanian/Downloads/Myntra-Android-qa.apk” /data/local/tmp/396704003712edcec12bc62efd3f16f4.apk
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “am force-stop com.myntra.android”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 uninstall com.myntra.android
debug: App was not uninstalled, maybe it wasn’t on device?
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “pm install -r /data/local/tmp/396704003712edcec12bc62efd3f16f4.apk”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 forward tcp:8080 tcp:8080
debug: Pushing unlock helper app to device…
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 install “/Applications/Appium.app/Contents/Resources/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk”
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “dumpsys window”
debug: Screen already unlocked, continuing.
debug: executing: “/Users/c.sivasubramanian/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb” -s 4d0061964e7f3177 shell “am instrument -e main_activity ‘com.myntra.android.activities.LoginRegisterActivity’ com.myntra.android.selendroid/io.selendroid.ServerInstrumentation”
error: Failed to start an Appium session, err was: Error: Waited 20 secs for selendroid server and it never showed up

Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Making http request with opts: {“url”:“http://localhost:8080/wd/hub/status",“method”:"GET”}
info: Cleaning up appium session
info: Error: Waited 20 secs for selendroid server and it never showed up
at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/selendroid.js:261:14
at Request._callback (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/common.js:104:5)
at self.callback (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/request/request.js:121:22)
at Request.EventEmitter.emit (events.js:95:17)
at ClientRequest.self.clientErrorHandler (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/request/request.js:230:10)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketOnEnd [as onend] (http.js:1568:9)
at Socket.g (events.js:180:16)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
info: Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Waited 20 secs for selendroid server and it never showed up)”,“origValue”:“Waited 20 secs for selendroid server and it never showed up”},“sessionId”:null}
POST /wd/hub/session 500 35945ms - 268b

debug: Appium request initiated at /wd/hub/status

info: Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.1.0”,“revision”:“e433bbc31511f199287db7724e1ce692bcb32117”}}}

debug: Request received with params: {}

GET /wd/hub/status 200 2ms - 143b

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.