简体   繁体   English

Chrome 远程调试 - 如何检查混合应用程序中的元素(webview)

[英]Chrome Remote Debugging - how to inspect elements in hybrid app (webview)

I am trying to automate Gmail app for Android.我正在尝试为 Android 自动化 Gmail 应用程序。 In the "Compose" page, the part of the body of the message is a webview context.在“撰写”页面中,消息正文的一部分是 webview 上下文。 Using uiautomatorviewer i managed to retrieve the locator of the "body" element, but sending text to it - fails.使用 uiautomatorviewer 我设法检索了“body”元素的定位器,但向它发送文本 - 失败。 Trying to switch context to "WEBVIEW" (i am using Appium) also fails.尝试将上下文切换到“WEBVIEW”(我正在使用 Appium)也失败了。 I wish to inspect elements in this page using chrome remote debugging.我希望使用 chrome 远程调试来检查此页面中的元素。 On my computer, i navigated to chrome://inspect/#devices and i launched the application on the android emulator.在我的电脑上,我导航到chrome://inspect/#devices并在 android 模拟器上启动了该应用程序。 It looks alright.看起来不错。 在此处输入图像描述 But when i try to inspect elements, i see none.但是当我尝试检查元素时,我什么也没看到。 在此处输入图像描述 What am i missing?我错过了什么? (i made sure the to enable debugging and become a developer...) (我确保启用调试并成为开发人员......)

To enable WebView debugging setWebContentsDebuggingEnabled should be set on the WebView class.要启用 WebView 调试setWebContentsDebuggingEnabled应在 WebView class 上设置。 You need to make this change in your app code and rebuild it.您需要在您的应用程序代码中进行此更改并重新构建它。

Following these instructions was good enough for me遵循这些说明对我来说已经足够了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM