我在mac操作系统(Catalina 10.15.7(上使用Selenium Java w/chromedriver不断收到这个错误,
Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event
我在谷歌上搜索了一下,有些人说,当你在谷歌Chrome上打开Chrome开发工具时,就会发生这种情况。我没有任何打开的Windows,但它仍在发生。
我使用的是Google Chrome版本91.0.4472.77
和chromedriver版91.0.4472.19
。你知道这里发生了什么吗?有时我可以让应用程序成功运行1次平局,但90%的时间它都会抛出这个异常——发生了什么?
在chromeOptions
中,初始化chromedriver时,添加以下内容:
chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE);
如果这有帮助,请告诉我。