Search code examples
androidseleniumappium

I'm Automating android hybrid application using appium, I am unable to switch to the WEBVIEW


Environment details are given below :

  1. The application is developed Using Corodova ionic
  2. Appium version 1.4.16.1
  3. Android version 6 (Nougat)

My work is totally blocked due to this issue. can anyone help me to get out of this issue. please revert back if anymore information is required.

The Java code is as below :

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
public class sample2 {

AppiumDriver<MobileElement> driver;
public void setup(){

DesiredCapabilities dc = new DesiredCapabilities();

dc.setCapability(CapabilityType.BROWSER_NAME,"Android");
dc.setCapability(CapabilityType.VERSION,"7.0");
dc.setCapability("deviceName","b133582d");
dc.setCapability("platformName", "Android");
dc.setCapability("appPackage", "io.ionic.starter");
dc.setCapability("appActivity", "io.ionic.starter.MainActivity");


    try {
        driver= new AppiumDriver<MobileElement>(new 
URL("http://127.0.0.1:4723/wd/hub"), dc);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }}
public void start(){

    Set<String> contextNames = driver.getContextHandles();
    for (Object contextName : contextNames) {
        String setContext = contextNames.toArray()[1].toString();
        System.out.println(contextName);
        driver.context(setContext);
    }
    System.out.println("Switched to webview");

}

public void close(){
    driver.quit();
}

public static void main(String[] args) {
    sample2 action = new sample2();
    action.setup();
    action.start();
    action.close();

}

}

And below is the Appium Logs :

> info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
> info: Console LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","browserName":"Android","platformName":"Android","version":"7.0","deviceName":"b133582d"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","browserName":"Android","platformName":"Android","version":"7.0","deviceName":"b133582d"},"requiredCapabilities":{},"alwaysMatch":{"browserName":"Android","platformName":"Android"},"firstMatch":[]}}
> info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_141)
> info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
> info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
> info: [debug] Creating new appium session 88ef3e15-3f29-473b-aa4b-6241655016ab
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.8.0_141
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from E:\path\platform-tools\adb.exe
> warn: No app capability, can't parse package/activity
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device b133582d
> info: [debug] Setting device id to b133582d
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d wait-for-device
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 24
> info: Device API level is: 24
> info: [debug] Extracting strings for language: default
> info: [debug] Apk doesn't exist locally
> info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "rm -rf /data/local/tmp/strings.json"
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] Skipping install since we launched with a package instead of an app path
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: [debug] Pushing settings apk to device...
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "ps"| grep uiautomator
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: E:\path\platform-tools\adb.exe -s b133582d shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg io.ionic.starter -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] Warning: This version of UI Automator is deprecated. New tests should be written using
> info: [debug] [UIAUTOMATOR STDOUT] UI Automator 2.0 which is available as part of the Android Testing Support Library.
> info: [debug] [UIAUTOMATOR STDOUT] See https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html
> info: [debug] [UIAUTOMATOR STDOUT] for more details.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Waking up device if it's not alive
> info: [debug] Pushing command to appium work queue: ["wake",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: wake
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "dumpsys window"
> info: [debug] Screen already unlocked, continuing.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] dataDir set to: /data/local/tmp
> info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
> info: [debug] Getting device API level
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 24
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.ionic.starter/io.ionic.starter.MainActivity"
> info: [debug] Waiting for pkg "io.ionic.starter" and activity "io.ionic.starter.MainActivity" to be focused
> info: [debug] Getting focused package and activity
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "dumpsys window windows"
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "getprop ro.build.version.release"
> info: [debug] Device is at release version 7.0
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to the default of 60 secs
> info: [debug] Appium session started with sessionId 88ef3e15-3f29-473b-aa4b-6241655016ab
> info: <-- POST /wd/hub/session 303 14500.746 ms - 74 
> info: --> GET /wd/hub/session/88ef3e15-3f29-473b-aa4b-6241655016ab {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"7.0","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","browserName":"Android","platformName":"Android","version":"7.0","deviceName":"b133582d"},"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","platformName":"Android","version":"7.0","deviceName":"b133582d"},"sessionId":"88ef3e15-3f29-473b-aa4b-6241655016ab"}
> info: <-- GET /wd/hub/session/88ef3e15-3f29-473b-aa4b-6241655016ab 200 6.920 ms - 637 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"7.0","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","browserName":"Android","platformName":"Android","version":"7.0","deviceName":"b133582d"},"appPackage":"io.ionic.starter","appActivity":"io.ionic.starter.MainActivity","platformName":"Android","version":"7.0","deviceName":"b133582d"},"sessionId":"88ef3e15-3f29-473b-aa4b-6241655016ab"}
> info: --> GET /wd/hub/session/88ef3e15-3f29-473b-aa4b-6241655016ab/contexts {}
> info: [debug] Getting a list of available webviews
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "cat /proc/net/unix"
> info: [debug] WEBVIEW_9475 mapped to pid 9475
> info: [debug] Getting process name for webview
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "ps"
> info: [debug] Parsed pid: 9475 pkg: io.ionic.starter
> info: [debug] from: u0_a252,9475,892,2683060,309148,SyS_epoll_,0000000000,S,io.ionic.starter
> info: [debug] returning process name: io.ionic.starter
> info: [debug] Available contexts: 
> info: [debug] ["WEBVIEW_io.ionic.starter"]
> info: [debug] Available contexts: NATIVE_APP,WEBVIEW_io.ionic.starter
> info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_io.ionic.starter"],"sessionId":"88ef3e15-3f29-473b-aa4b-6241655016ab"}
> info: <-- GET /wd/hub/session/88ef3e15-3f29-473b-aa4b-6241655016ab/contexts 200 911.535 ms - 113 {"status":0,"value":["NATIVE_APP","WEBVIEW_io.ionic.starter"],"sessionId":"88ef3e15-3f29-473b-aa4b-6241655016ab"}
> info: --> POST /wd/hub/session/88ef3e15-3f29-473b-aa4b-6241655016ab/context {"name":"WEBVIEW_io.ionic.starter"}
> info: [debug] Getting a list of available webviews
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "cat /proc/net/unix"
> info: [debug] WEBVIEW_9475 mapped to pid 9475
> info: [debug] Getting process name for webview
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "ps"
> info: [debug] Parsed pid: 9475 pkg: io.ionic.starter
> info: [debug] from: u0_a252,9475,892,2711772,270076,SyS_epoll_,0000000000,S,io.ionic.starter
> info: [debug] returning process name: io.ionic.starter
> info: [debug] Available contexts: NATIVE_APP,WEBVIEW_io.ionic.starter
> info: [debug] ["WEBVIEW_io.ionic.starter"]
> info: [debug] Available contexts: NATIVE_APP,WEBVIEW_io.ionic.starter
> info: [debug] Connecting to chrome-backed webview
> info: Chromedriver: Changed state to 'starting'
> info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
> info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
> info: Chromedriver: No old chromedrivers seemed to exist
> info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
> info: Chromedriver: [STDOUT] Starting ChromeDriver 2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a) on port 9515
> Only local connections are allowed.
> info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0\"}}}"
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"io.ionic.starter","androidUseRunningApp":true,"androidDeviceSerial":"b133582d"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"4c59842f9864cecaf4038996875fd96e","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"io.ionic.starter","androidUseRunningApp":true,"androidDeviceSerial":"b133582d"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"ad8cecc823f31a7ac036937b8cb171b2","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"io.ionic.starter","androidUseRunningApp":true,"androidDeviceSerial":"b133582d"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"1fbc321fdd899ed21bd39695e082df5d","status":33,"value":{"message":"session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\...
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"io.ionic.starter","androidUseRunningApp":true,"androidDeviceSerial":"b133582d"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"99abddcaed1a3c57de455b84443be8bf","status":13,"value":{"message":"unknown error: Device b133582d is not online\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d...
> error: Chromedriver: Chromedriver exited unexpectedly with code null, signal SIGTERM
> info: Chromedriver: Changed state to 'stopped'
> warn: Chromedriver for context WEBVIEW_io.ionic.starter stopped unexpectedly
> warn: Chromedriver quit unexpectedly, but it wasn't the active context, ignoring
> error: Chromedriver: Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device b133582d is not online
>   (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))
>     at JWProxy.command$ (lib/proxy.js:133:15)
>     at tryCatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:67:40)
>     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:315:22)
>     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
>     at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:136:37)
>     at bound (domain.js:284:14)
>     at GeneratorFunctionPrototype.runBound (domain.js:297:12)
>     at run (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:89:39)
>     at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:100:28
>     at flush (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\$.microtask.js:17:13)
>     at process._tickDomainCallback (node.js:381:11)
>  { [Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device b133582d is not online
>   (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64))]
>   status: 13,
>   value: { message: 'unknown error: Device b133582d is not online\n  (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64)' },
>   httpCode: 200 }
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: [debug] Pressing the HOME button
> info: [debug] executing cmd: E:\path\platform-tools\adb.exe -s b133582d shell "input keyevent 3"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 65.795
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] UiAutomator shut down normally
> info: [debug] Cleaning up android objects
> info: [debug] Cleaning up appium session
> info: [debug] We shut down because no new commands came in

Solution

  • There is no need of using driver.context(setContext);

    For Android OS Version 6.0 and above the new UIAutomator has in built capabilities to identify the webView elements also. Make sure you have updated the Android System WebView in your device, if it is not updated then you can update through PlayStore.

    Also, You should have the latest version of Android SDK packages. If not then you can update that too using Android SDK Manager.

    With the above configuration your problem should be resolved. If it is not resolved then you should try below options :

    To see the WebView inside UIAutomator Developer of your hybrid should enable the "setWebContentsDebuggingEnabled" in Android source code of your app.

    How to check whether setWebCOntentDebuggingEnabled is set to true for your app:

    1.Connect device to machine. 2.Open the screen of your app which has WebView. 3.Open chrome browser on the machine. 4.Enter "chrome://devices/" in the chrome browser address bar and hit enter.

    If you see your device in the list and option to view then webView debugging is enabled for your app. If not visible then not enabled.