android - 检查 WebView 元素时出现 UiAutomator 错误

标签 android webview appium android-uiautomator

我最近开始在 android 中进行自动化测试,并使用 UiAutomator 工具检查 UI 元素。令人惊讶的是,我遇到了针对同一屏幕和同一设备 [Genymotion MotoX 4.4.4] 的 Webview 元素的两种不同响应。附件是相同的屏幕截图。我们都知道 appium 在检查未将“setWebContentsDebuggingEnabled”设置为 true 的 webview 元素时存在问题。这是 UiAutomator 中的错误吗? Screen displaying child elements of webview

Screen without WebView children

最佳答案

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?

,这不是错误。它是一个实现。除非 setWebContentsDebuggingEnabled 设置为 true,否则您无法调试或访问 webview 内的任何元素。

引自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.

你可能也对这些感兴趣:

Migrating to WebView in Android 4.4

关于android - 检查 WebView 元素时出现 UiAutomator 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37274388/

相关文章:

android - 在 Android 中使用 loadDataWithBaseURL() 显示图像时出现问题

android - 使用 firefox 作为 Android webview 的渲染引擎

angularjs - Protractor - 如何验证切换按钮是否已选择/启用或未选择?

java - 如果 beforeclass 注释中的驱动程序初始化失败,则测试用例不会失败

android - 我们可以在appium中通过ID找到元素吗

java - 使用 Reactive Android 拉动刷新时添加更多订阅

android - 如何在自定义 Spinner DropDownView 中指定选择事件?

Android - 同一行中的两个按钮填充整个宽度

android - 从 fragment 调用 startActivityForResult 时出错

java - Android 应用程序 Web View 后退按钮