Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UiAutomator bug while inspecting WebView elements

I have recently started automation testing in android and was using UiAutomator tool for inspecting UI elements. Surprisingly, I came across two different responses for Webview elements for the same screen and same device [Genymotion MotoX 4.4.4]. Attached are the screenshots for the same. We all know that appium has an issue with inspecting webview elements who do not carry "setWebContentsDebuggingEnabled" to true. Is this a bug in UiAutomator? Screen displaying child elements of webview

Screen without WebView children

like image 576
Rashmi.B Avatar asked Apr 10 '26 08:04

Rashmi.B


1 Answers

We all know that appium has an issue with inspecting webview elements who do not carry "setWebContentsDebuggingEnabled" to true. Is this a bug in UiAutomator?

NO, its not a bug. Its an IMPLEMENTATION as is. Unless the setWebContentsDebuggingEnabled is set to true, you cannot debug or access any elements inside a webview.

To quote from developers.android.com

void setWebContentsDebuggingEnabled (boolean enabled)

Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. This flag can be enabled in order to facilitate debugging of web layouts and JavaScript code running inside WebViews. Please refer to WebView documentation for the debugging guide. The default is false.

You might be interested into these as well :

Migrating to WebView in Android 4.4

like image 110
Naman Avatar answered Apr 13 '26 00:04

Naman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!