"Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event" with Selenium Java

Issue

I kept getting this error using Selenium Java w/ chromedriver on my mac OS (Catalina 10.15.7),

Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event

I googled and some people were sayin it happens when you have Chrome developer tools open on google chrome. I don’t have any Windows with this open but it is still happening.

I am using Google Chrome version 91.0.4472.77 and chromedriver version 91.0.4472.19. Any ideas of what’s going on here? Sometimes I can get the application to run 1 tie successfully, but 90% of the time it throws this exception – what’s going on?

Solution

In your chromeOptions, when you initialize chromedriver, add the following:

chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE);

Let me know if that helps at all.

Answered By – C. Peck

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published