问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/37274388/uiautomator-bug-while-inspecting-webview-elements