Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Driver call in v1.5.1 (selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools) #52

Closed
1 task done
CabbageMcHead opened this issue Jun 23, 2023 · 5 comments · Fixed by #50, #51, #53 or #54
Labels
bug Something isn't working

Comments

@CabbageMcHead
Copy link

Is there already an issue for your problem?

  • I have checked older issues, open and closed

Bug Description

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/IMDBTraktSyncer/IMDBTraktSyncer.py", line 235, in main
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, '[data-testid="tm-box-wl-loader"]')))
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 86, in until
value = method(self._driver)
^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/support/expected_conditions.py", line 300, in _predicate
target = driver.find_element(*target)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 831, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools
(failed to check if window was closed: disconnected: not connected to DevTools)
(Session info: chrome=114.0.5735.133)
Stacktrace:
0 chromedriver_mac_arm64 0x00000001011fc2b8 chromedriver_mac_arm64 + 4260536
1 chromedriver_mac_arm64 0x00000001011f494c chromedriver_mac_arm64 + 4229452
2 chromedriver_mac_arm64 0x0000000100e309d4 chromedriver_mac_arm64 + 281044
3 chromedriver_mac_arm64 0x0000000100e19c48 chromedriver_mac_arm64 + 187464
4 chromedriver_mac_arm64 0x0000000100e19a30 chromedriver_mac_arm64 + 186928
5 chromedriver_mac_arm64 0x0000000100ea2030 chromedriver_mac_arm64 + 745520
6 chromedriver_mac_arm64 0x0000000100e5f98c chromedriver_mac_arm64 + 473484
7 chromedriver_mac_arm64 0x0000000100e6098c chromedriver_mac_arm64 + 477580
8 chromedriver_mac_arm64 0x00000001011baa6c chromedriver_mac_arm64 + 3992172
9 chromedriver_mac_arm64 0x00000001011becd0 chromedriver_mac_arm64 + 4009168
10 chromedriver_mac_arm64 0x00000001011c4d48 chromedriver_mac_arm64 + 4033864
11 chromedriver_mac_arm64 0x00000001011bf940 chromedriver_mac_arm64 + 4012352
12 chromedriver_mac_arm64 0x000000010119757c chromedriver_mac_arm64 + 3847548
13 chromedriver_mac_arm64 0x00000001011dd400 chromedriver_mac_arm64 + 4133888
14 chromedriver_mac_arm64 0x00000001011dd558 chromedriver_mac_arm64 + 4134232
15 chromedriver_mac_arm64 0x00000001011edc3c chromedriver_mac_arm64 + 4201532
16 libsystem_pthread.dylib 0x000000019307ffa8 _pthread_start + 148
17 libsystem_pthread.dylib 0x000000019307ada0 thread_start + 8

Environment

MacOS Ventura 13.4

Screenshots

No response

@RileyXX
Copy link
Owner

RileyXX commented Jun 24, 2023

Hi again! I will be investigating this issue. First I have a couple questions:

  1. Are you getting this error specifically on v1.5.1 or are you also getting this error on v1.4.2?
  2. Does it give you the same error every time or does it fail at different points?
    • Specifically I'm looking to see if this bug is coming from wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, '[data-testid="tm-box-wl-loader"]'))) in particular or if it is also failing at different points.

I did some research and it seems other users are reporting similar issues on Mac, some related to invisibility_of_element_located (Link #1, Link #2, Link #3). Apparently some people are saying it works for them occasionally on MacOS, and sometimes it crashes. This might be a potential bug with chromedriver on MacOS. There may be some type of port conflict with the dev tools or invisibility_of_element_located is causing chrome or chromedriver to crash.

selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools
(failed to check if window was closed: disconnected: not connected to DevTools)

The error message indicates that the WebDriver is not connected to DevTools.

Some things you can try:

  • Make sure selenium is updated to the latest version using python -m pip install selenium --upgrade
  • Make sure chrome is updated to the latest version by opening Chrome and entering chrome://settings/help in the url bar.
  • Restart your computer and then run the script again and see if the issue persists
  • If the issue still persists, you can downgrade IMDBTraktSyncer to v1.4.2 using python -m pip install IMDBTraktSyncer==1.4.2. If this version works for you, then you can use it for now until a fix or workaround is implemented. v1.4.2 is the latest version that doesn't use invisibility_of_element_located.

Because it failed for you at wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, '[data-testid="tm-box-wl-loader"]'))) then I'm assuming a bug with invisibility_of_element_located on MacOS is likely the cause. What I can do is try to implement a workaround solution for Mac that doesn't use invisibility_of_element_located. But first if you could please answer the 2 questions above so I can verify if invisibility_of_element_located is the cause of the issue. Thanks!

@CabbageMcHead
Copy link
Author

CabbageMcHead commented Jun 24, 2023 via email

@CabbageMcHead
Copy link
Author

CabbageMcHead commented Jun 24, 2023 via email

@RileyXX
Copy link
Owner

RileyXX commented Jun 27, 2023

Thanks for confirming that 1.4.2 is working without issue! It seems wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, '[data-testid="tm-box-wl-loader"]'))) may not be directly causing this error. There may be something else causing chromedriver to crash or some other issue. There are a few changes to IMDB requests in v1.5.4 which may or may not fix this problem. When you get some time give it a try and let me know how it goes.

You can upgrade to the latest version using the following:

python -m pip install IMDBTraktSyncer --upgrade

If you are still experiencing this error you can downgrade back to v1.4.2 again using the following:

python -m pip install IMDBTraktSyncer==1.4.2

@RileyXX RileyXX changed the title Issue with Driver call in v1.5.1 Issue with Driver call in v1.5.1 (selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools) Jun 27, 2023
@RileyXX RileyXX added the bug Something isn't working label Jun 27, 2023
@CabbageMcHead
Copy link
Author

CabbageMcHead commented Jun 28, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment