如何使用JAVA在Selenium WebDriver中打开Chrome Developer控制台 [英] How to open Chrome Developer console in Selenium WebDriver using JAVA

查看:447
本文介绍了如何使用JAVA在Selenium WebDriver中打开Chrome Developer控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何在执行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.

推荐答案

你做不到。 Chrome驱动程序使用Chrome远程调试协议与浏览器进行通信。这与开发人员控制台也使用的协议相同。不幸的是,Chrome的设计使得一次只能使用协议连接一个客户端,因此这意味着开发人员工具或驱动程序,但不能同时使用。

You can't. The Chrome driver uses the Chrome remote debugging protocol to communicate with the browser. This is the same protocol that the developer console uses also. Unfortunately, Chrome is designed so that only one client can be attached using the protocol at a time, so that means either the developer tools, or the driver, but not both simultaneously.

这篇关于如何使用JAVA在Selenium WebDriver中打开Chrome Developer控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆