Android Webview confusion

I am trying to automate a hybrid Android app on Appium 1.4.x/1.5.x, but cannot see any controls (using either Inspector or with code) inside the web view, even though:

  • The app does call Webview.setWebContentsDebuggingEnabled(true).
  • The android.webkit.WebView control is visible and inspectable in chrome://inspect.
  • The android.webkit.WebView control itself is visible in Appium Inspector and the context is set to the sole webview context.

Now, I take the ApiDemos (in the Appium submodules) and try to not see any controls inside of android.webkit.WebView while using the same environment and configuration. Unfortunately, I do see controls inside the android.webkit.WebView controls using Appium Inspector even though:

  • I comment out all the calls to Webview.setWebContentsDebuggingEnabled(true).
  • The android.webkit.WebView controls are not visible or inspectable in chrome://inspect.
  • Appium Inspector using the default context.

I have automated several hybrid Android apps with no issue, so seeing behavior exactly opposite of what should happen is baffling. What am I doing missing here?

Note:I just disabled calling Webview.setWebContentsDebuggingEnabled(true) in my app and the contents of the webview now appear in Appium inspector. What is going on???

I should mention that when I see controls inside the web view, they show up as native android controls, not web controls.

I have solved half the problem. The content in the HTML in my app has aria-hidden='true', which apparently causes Appium to ignore the content completely. It still doesn’t explain why i can see inside the web controls (without the aria-hidden flag set) with Inspector (albeit with native controls) even though the web content debugging flag is false.

1 Like