如何使用 JAVA 在 Selenium WebDriver 中打开 Chrome 开发者控制台 [英] How to open Chrome Developer console in Selenium WebDriver using JAVA
问题描述
我想问一下如何在selenium测试执行期间打开Chrome开发者控制台.目前,当测试正在执行时,我手动按 F12 打开控制台,测试会立即停止响应并在一段时间后失败.
I want to ask how to open the Chrome developer Console during selenium tests execution. Currently, when tests are executing, and I open the console manually hitting F12, the tests stop responding immediately and fails after some time.
谁能告诉我如何在打开开发者控制台的情况下启动我的测试,以便我可以捕获/观察测试执行期间发生的控制台错误.
Can anyone tell me how can I initiate my tests with developer console opened, so I can catch/observe the console errors that occur during test execution.
推荐答案
使用--auto-open-devtools-for-tabs
:
此标志使 Chrome 为每个选项卡自动打开 DevTools 窗口.它旨在供开发人员和自动化使用,无需用户交互即可打开 DevTools.
This flag makes Chrome auto-open DevTools window for each tab. It is intended to be used by developers and automation to not require user interaction for opening DevTools.
这篇关于如何使用 JAVA 在 Selenium WebDriver 中打开 Chrome 开发者控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!