简体   繁体   English

断开错误org.openqa.selenium.WebDriverException的连接已断开:使用Selenium ChromeDriver和Chrome收到Inspector.detached事件

[英]Getting an error org.openqa.selenium.WebDriverException disconnected: received Inspector.detached event with Selenium ChromeDriver and Chrome

I am trying to run my automation script using selenium and Java and facing an error as: 我正在尝试使用selenium和Java运行自动化脚本,并遇到如下错误:

WebDriverException: Message: disconnected: received Inspector.detached event
    (Session info: chrome=76.0.3809.100)         
    (Driver info: chromedriver=76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024})

Can someone explain me the error please? 有人可以向我解释错误吗?

This error message... 此错误消息...

WebDriverException: Message: disconnected: received Inspector.detached event

...implies that the ChromeDriver was automatically disconnected when the test execution was In Progress . ......意味着,当测试执行的执行过程ChromeDriver已自动断开连接。

In the article DevTools window keeps closing it is clearly mentioned that if you try to open the DevTools window when the ChromeDriver is busy executing automated tests , the ChromeDriver automatically gets disconnected and when ChromeDriver receives a command in disconnected state, it will attempt to close the DevTools window and reconnect back. DevTools窗口保持关闭的文章中,明确提到如果您在ChromeDriver忙于执行自动化测试时尝试打开DevTools窗口,则ChromeDriver会自动断开连接,并且当ChromeDriver收到处于断开状态的命令时,它将尝试关闭DevTools窗口并重新连接回去。 Earlier Chrome's DevTools allowed only one debugger per page. 较早的Chrome的DevTools每页只允许一个调试器。 But since ChromeDriver v2.x, it is now a DevTools debugging client. 但是从ChromeDriver v2.x开始,它现在已成为DevTools调试客户端。

If your usecase is to inspect the DOM Tree through the DevTools, the best approach would be to pause your test execution so that ChromeDriver won't close the DevTools. 如果您的用是通过DevTools检查DOM树 ,则最好的方法是暂停测试执行,以使ChromeDriver不会关闭DevTools。 When you complete inspecting HTML DOM through Chrome, you can unpause your test and ChromeDriver will close the window and continue. 通过Chrome检查完HTML DOM后 ,您可以取消暂停测试,ChromeDriver将关闭该窗口并继续。

As per the discussion in unknown error: cannot determine loading status from disconnected: received Inspector.detached placing the ChromeDriver in path solves the issue. 根据有关未知错误的讨论:无法确定断开连接的加载状态:收到Inspector.detachedChromeDriver放置在路径中即可解决此问题。 So you need to: 因此,您需要:

driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver.get("https://google.com")

暂无
暂无

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

相关问题 org.openqa.selenium.WebDriverException: disconnected: 在使用 Selenium 和 Chromedriver 的测试执行期间收到 Inspector.detached 事件错误 - org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event error during test execution using Selenium and Chromedriver org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools error using ChromeDriver Chrome using Selenium and Java - org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools error using ChromeDriver Chrome using Selenium and Java org.openqa.selenium.WebDriverException:无法使用Selenium和ChromeDriver访问Chrome - org.openqa.selenium.WebDriverException: chrome not reachable using Selenium and ChromeDriver 使用最新的chromedriver 2.28出现错误-断开连接:收到Inspector.detached事件 - getting error using latest chromedriver 2.28 - disconnected: received Inspector.detached event org.openqa.selenium.WebDriverException:未知错误:chrome 无法通过 Java 开始使用 Selenium ChromeDriver 和 Chrome - org.openqa.selenium.WebDriverException: unknown error: chrome failed to start using Selenium ChromeDriver and Chrome through Java 错误 Selenium 无法检索文档 state 已断开连接:收到 Inspector.detached 事件 - Error Selenium Unable to retrieve document state disconnected: received Inspector.detached event org.openqa.selenium.WebDriverException:未知错误:无法通过Java用ChromeDriver Chrome和Selenium集中元素 - org.openqa.selenium.WebDriverException: unknown error: cannot focus element with ChromeDriver Chrome and Selenium through Java org.openqa.selenium.WebDriverException: chrome 无法访问 - org.openqa.selenium.WebDriverException: chrome not reachable org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed using ChromeDriver Selenium in Jenkins on Ubuntu 18.04 - org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed using ChromeDriver Selenium in Jenkins on Ubuntu 18.04 Selenium 3.8.1,ChromeDriver 2.34-org.openqa.selenium.WebDriverException:无法访问Chrome - Selenium 3.8.1, ChromeDriver 2.34 - org.openqa.selenium.WebDriverException: chrome not reachable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM