4

I'm trying to get the available application context and want to switch to the webview context but appium getting only Navive App.

Also application is WebView enabled.

  • Appium version: 1.10.1
  • ChromeDriver version: 2.44
  • Desktop OS/version: Windows 10
  • Node.js version: 10.14.2
  • Package manager:Npm
  • Mobile platform/version: Android/8.1.0
  • Real device or emulator/simulator:google pixel 2 emulator
  • Appium CLI or Appium.app|exe:Tried with both

        public void webView() {
               try {
                    Set<String> context = driver.getContextHandles();
    
                    for(String cont: context) {
                        System.out.println("Available Context : " + cont);
                        if(cont.contains("WEBVIEW")) {
                           driver.context(cont);
                           System.out.println("current context :"+cont);
                        } else {
                           System.out.println("Opps");
                        }
                    }
               } catch (InterruptedException e) {
                    e.printStackTrace();
               }
        }
    

I expect the output as Native App and WebView of application will be get but the actual output is only getting Native App.

qaWork4
  • 79
  • 1
  • 6

2 Answers2

0

Please ask your dev to set setWebContentsDebuggingEnabled to true. Refer following link https://developer.android.com/reference/android/webkit/WebView.html#setWebContentsDebuggingEnabled(boolean)

0

In IOS

Able to change context by safari.

but don't change context from webview of native app installed device