undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Chrome is stuck

Open orbar1 opened this issue 1 year ago • 18 comments

Hey guys, Noticed a weird behavior since yesterday when I tried to run my bot and it gave me some chromedriver error due to version. So I updated chrome's version to 121.0.6167.85 and downloaded chromedriver 121.0.6167.85

Then I noticed the chrome browser controlled by the bot, will get stuck at a random time after working fine for 1 iteration. The bot runs on Facebook and it ran just fine until yesterday's chrome & chromedriver update, nothing changed in code or anything else except for those 2 chrome & chromedriver changes.

I believe I had chrome version 120 before that..

Anyone else having similar behavior with their various bots?

undetected-chromedriver==3.5.3 selenium==4.12.0

orbar1 avatar Jan 26 '24 15:01 orbar1

Think I have the same issue only started happening within the last day or two. My bot will run for 5-6 mins and then it's like the internet connection within the selenium setup will go slow. A page that should take no more than 10 seconds in the worse scenario to load will now take upwards of 5 mins to load all the resources etc and then in my case is no good as everything times out.

KmanProdz avatar Jan 26 '24 17:01 KmanProdz

Same here, Chrome doesn't even start, and it's stuck until I Ctrl-C (both Chromium & Chromedriver version 121.0.6167.85, while it still works with older versions).

I also tried with local path chromedriver.

^CTraceback (most recent call last):
  File "/home/eric/./test.py", line 681, in <module>
    wd = prepare_webdriver()
         ^^^^^^^^^^^^^^^^^^^
  File "/home/eric/./test.py", line 56, in prepare_webdriver
    wd = uc.Chrome(options=options)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/.local/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 61, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in __init__
    self.start_session(capabilities)
  File "/home/eric/.local/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 292, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute
    response = self.command_executor.execute(driver_command, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 302, in execute
    return self._request(command_info[0], url, body=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eric/.local/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 322, in _request
    response = self._conn.request(method, url, body=body, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 78, in request
    return self.request_encode_body(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 170, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/poolmanager.py", line 376, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 704, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 450, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 445, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt

zsh: interrupt  python3 ./test.py

dembarthe avatar Jan 26 '24 17:01 dembarthe

Think I have the same issue only started happening within the last day or two. My bot will run for 5-6 mins and then it's like the internet connection within the selenium setup will go slow. A page that should take no more than 10 seconds in the worse scenario to load will now take upwards of 5 mins to load all the resources etc and then in my case is no good as everything times out.

Exactly!

orbar1 avatar Jan 26 '24 17:01 orbar1

Same here, Chrome doesn't even start, and it's stuck until I Ctrl-C (both Chromium & Chromedriver version 121.0.6167.85, while it still works with older versions).

Is it possible to lock chrome on the older version I had so I will just rollback and call it a day.

Maybe its just something with selenium version as the latest UC version still use an older selenium version..

I know its probably not a UC issue but just wanted to ask around.

orbar1 avatar Jan 26 '24 17:01 orbar1

I forced undetected chromedriver to use v120 and still having the same issues so I will try downgrading selenium pkg as well

KmanProdz avatar Jan 26 '24 17:01 KmanProdz

Selenium version 4.16.0 working for me fine

KmanProdz avatar Jan 26 '24 18:01 KmanProdz

Selenium version 4.16.0 working for me fine

With UC version 3.5.3? Just uninstalled selenium 4.12.0 and installled 4.16.0 solved the problem?

Asking cuz latest Selenium version didnt work with UC 3.5.3 earlier today when I tried.

orbar1 avatar Jan 26 '24 18:01 orbar1

I'm on UC 3.5.4 with Selenium 4.16.0

KmanProdz avatar Jan 26 '24 18:01 KmanProdz

Ah I wasnt aware of 3.5.4, I was convinced I am with latest (3.5.3), will upgrade and try again, thanks for the help!

orbar1 avatar Jan 26 '24 19:01 orbar1

I'm on UC 3.5.4 with Selenium 4.16.0

Just got to test my bot now, UC 3.5.4 and selenium 4.16.0 still doesnt solve it, browser will "lose internet connection" again and get stuck :/

orbar1 avatar Jan 28 '24 13:01 orbar1

I'm on UC 3.5.4 with Selenium 4.16.0

Just got to test my bot now, UC 3.5.4 and selenium 4.16.0 still doesnt solve it, browser will "lose internet connection" again and get stuck :/

I don't think it's the issue, I have UC 3.5.4 and Selenium 4.17.2 and unable to run it also.

dembarthe avatar Jan 28 '24 14:01 dembarthe

I don't think it's the issue, I have UC 3.5.4 and Selenium 4.17.2 and unable to run it also.

Yea I tried that combo first, then downgraded selenium to 4.16.0 as @KmanProdz suggested, but as I said it also doesn't work so no clue right now really.

orbar1 avatar Jan 28 '24 14:01 orbar1

yes, I am also facing this problem. Also, I am creating issues that link below : https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/1709

mominurr avatar Feb 02 '24 11:02 mominurr

yes, I am also facing this problem. Also, I am creating issues that link below : #1709

any luck solving it without tricks? i think it's a matter of chrome version having some issues with selenium version, i have not tried running my code without UC so i can't confirm yet.

orbar1 avatar Feb 02 '24 12:02 orbar1

I think partially what was the issue in mine, was that I had an isolated issue in one of my threads where I had an while loop that wasn't breaking out which suddenly caused all threads which each had an uc instance and browser to bug out and essentially lose internet/load slow so after I fixed that all the issues went away. There is however definitely an issue with chrome v121 with it having an memory leak so I've fixed mine to work only on chrome v120 for now with the UC versions mentioned.

KmanProdz avatar Feb 04 '24 12:02 KmanProdz

so I've fixed mine to work only on chrome v120 for now with the UC versions mentioned.

so turns out that adding "version_main=120" solved it for now.

also added as a bonus those options which are nice: options.set_capability('unhandledPromptBehavior', 'dismiss') options.add_argument('--disable-extensions') options.add_argument('--disable-gpu') options.add_argument('--no-sandbox') options.add_argument('--disable-notifications') options.add_argument('--disable-popup-blocking')

orbar1 avatar Feb 06 '24 11:02 orbar1

I use selenium version 4.16.0 and UC Driver version 3.5.5 and also down grid the version selenium 4.12.0 and UC driver version 3.5.3 chrome version v120 but still stuck browser after 2-3 runs

mdashiqu avatar Jul 23 '24 15:07 mdashiqu