3

I'm getting an error

E
======================================================================
ERROR: test_01Login (__main__.LoginTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:/Users/amal/AppData/Local/Continuum/anaconda3/Lib/site-packages/Sucess/Test/Login_sj.py", line 29, in test_01Login
    driver.get("https://google.com")
  File "C:\Users\amal\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\amal\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\amal\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: received Inspector.detached event
  (Session info: chrome=76.0.3809.100)


----------------------------------------------------------------------
Ran 1 test in 8.615s

FAILED (errors=1)

while trying to automate a webpage using python 3.7 and selenium 3.141.0

This is in windows 10. My java version is jdk-12.0.2 and chrome driver is ChromeDriver 76.0.3809.68

driver = webdriver.Chrome()
driver.get("https://google.com")

I'm new to Automation and learning by trial and error and excuse for any mistake as I just created this account and trying to post in any forum for the first time. I tried to reinstall Java, Chrome and tried multiple versions of chromedriver. Any help would be much appreciated.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Whoami iWorld
  • 31
  • 1
  • 3
  • always put full error message in question (not comment) as text (not screenshot). There are other useful information. – furas Aug 08 '19 at 01:50
  • Yes sir, have been trying to resolve this issue for about 4-5 days and i see everyone recommends updating the chrome webdriver or java version. I see that it works in another machine without issues, not sure what else to compare. I'm adding full error in initial comment now as i'm unable to paste here. – Whoami iWorld Aug 08 '19 at 02:10
  • sometimes chromedriver need specific version of chrome browser. Maybe with your error you should ask chromedriver's authors or chromdriver's forum. – furas Aug 08 '19 at 02:54
  • error is in line 29. what else do you have in lines 1-28 ? – furas Aug 08 '19 at 02:55
  • Actually all others have been commented out and only i'm calling the two lines above. My chrome driver is version 76.0.3809.68 and chrome browser is 76.0.3809.100. I have posted this query in chrome help forum also. Thanks @furas – Whoami iWorld Aug 08 '19 at 03:16

1 Answers1

2

This error message...

WebDriverException: Message: disconnected: received Inspector.detached event

...implies that the ChromeDriver was automatically disconnected when you tried to open the DevTools window.

As per the article DevTools window keeps closing 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. Earlier Chrome's DevTools allowed only one debugger per page. But since ChromeDriver v2.x, it is now a DevTools debugging client.

If you need 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. When you complete inspecting HTML DOM through Chrome, you can unpause your test and ChromeDriver will close the window and continue.

As per the discussion in unknown error: cannot determine loading status from disconnected: received Inspector.detached placing the ChromeDriver in path solves the issue. So you need to:

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

PS: Ensure that you are using the latest ChromeDriver v76.0 and Chrome v76.0.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I still see this issues on my Macbook. The solution you mentioned did not worked as well. The surprising part is that this issue happens randomly, I mean sometime works sometime get this error. And websites like duckduck go where I did not see this issue. Error I'm getting """ >>Current google-chrome version is 91.0.4472 >>Get LATEST driver version for 91.0.4472 >>Driver . . raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: disconnected: received Inspector.detached event (Session info: chrome=91.0.4472.77) """ – Prashant Pathak Jun 06 '21 at 09:52