ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.71k stars 1.14k forks source link

Selenium 4.10.0 is not compatible with the current undetected_chromedriver 3.4.7 #1318

Open ruzrobert opened 1 year ago

ruzrobert commented 1 year ago

Hi! After upgrading to the Seleniun 4.10.0 (last version) getting this error when trying to start the undetected_chromedriver (3.4.7): Catched exc "TypeError": __init__() got an unexpected keyword argument 'executable_path' 1) File "/var/apps/venv/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 453

mdmintz commented 1 year ago

The deprecated methods from selenium have been removed: https://github.com/SeleniumHQ/selenium/commit/9f5801c82fb3be3d5850707c46c3f8176e3ccd8e

Screenshot 2023-06-07 at 3 05 04 PM

In order to resolve this issue via undetected-chromedriver, the removed parameters will need to be passed in via Options or Service. Otherwise this repo is broken unless selenium is pinned to 4.9.1 in the meantime.

HugoLunel commented 1 year ago

Alternative temporary fix is to force use selenium 4.9 in the virtual env

t3ch-support commented 1 year ago

I can confirm this, however pinning selenium to 4.9 breaks with the current version of Chrome:

This version of ChromeDriver only supports Chrome version 112 Current browser version is 114.0.5735.110

mdmintz commented 1 year ago

@t3ch-support See the undetected-chromedriver ReadMe. Your issue can be resolved by setting version_main to the major browser version, (eg 114), when calling uc.Chrome(). Eg. driver=uc.Chrome(version_main=114). selenium can be pinned safely to 4.9.1 without issue if done correctly.

ultrafunkamsterdam commented 1 year ago

Please test 3.5.0 branch someone ?

Known issue: first remove driver manually from appdata folder Known issue2: when using context manager it will hang but still control-c-able

SKnight79 commented 1 year ago

worked for me: pip uninstall selenium pip install selenium==4.9.1

GuanLong-Lyu commented 1 year ago

After I changed the version of selenium from 4.10.0 to 4.9.1, still got the same error.

selenium 4.9.1 undetected-chromedriver 3.4.7

ruzrobert commented 1 year ago

@GuanLong-Lyu works for me, Python 3.9, virtualenv

GuanLong-Lyu commented 1 year ago

@GuanLong-Lyu works for me, Python 3.9, virtualenv

Thanks for the reply! I'm using Python 3.7.9, virtualenv. But not sure if this issue is caused by Python version.

GuanLong-Lyu commented 1 year ago

@GuanLong-Lyu works for me, Python 3.9, virtualenv

Thanks for the reply! I'm using Python 3.7.9, virtualenv. But not sure if this issue is caused by Python version.

Never mind, the issue was solved by rebooting. :)

dustinfarris commented 1 year ago

Please test 3.5.0 branch someone ?

3.5.0 works for me 👍

GISH123 commented 1 year ago

@t3ch-support See the undetected-chromedriver ReadMe. Your issue can be resolved by setting version_main to the major browser version, (eg 114), when calling uc.Chrome(). Eg. driver=uc.Chrome(version_main=114). selenium can be pinned safely to 4.9.1 without issue if done correctly.

my code still breaks, im testing every method i can, but still it still shows the error:

image i downloaded 114 chromedriver and try to use it via executable_path, not working can anyone help me 😢😢

ultrafunkamsterdam commented 1 year ago

update to 3.5.0

pip uninstall undetected-chromedriver 
select yes 
pip install -U undetected-chromedriver
GISH123 commented 1 year ago

update to 3.5.0

pip uninstall undetected-chromedriver 
select yes 
pip install -U undetected-chromedriver

Very much appreciated!

GISH123 commented 1 year ago

update to 3.5.0

pip uninstall undetected-chromedriver 
select yes 
pip install -U undetected-chromedriver

After doing this, i still have the same issue though....

my UC is already 3.5.0

image

What did i miss?

Romhast commented 1 year ago

update to 3.5.0

pip uninstall undetected-chromedriver 
select yes 
pip install -U undetected-chromedriver

After doing this, i still have the same issue though....

my UC is already 3.5.0

image

What did i miss?

same problem, my uc 3.5.0

mdmintz commented 1 year ago

I think undetected-chromedriver can benefit from autodetecting the browser version so that specifying version_main isn't required. I already have the code for that, which I borrowed from selenium manager: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/detect_b_ver.py

I combined that with UC Mode into SeleniumBase so that it simplifies setup.

from seleniumbase import Driver
import time

driver = Driver(uc_cdp=True, incognito=True)
driver.get("https://nowsecure.nl/#relax")
time.sleep(8)
driver.quit()

With detect_b_ver.py, people will no longer need to specify the browser/driver version themselves.

Spykerwolf commented 1 year ago

I'm getting selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:6409 from session not created: This version of ChromeDriver only supports Chrome version 111 Current browser version is 114.0.5735.134 with Python 3.10.4, undetected-chromedriver 3.5.0 & selenium 4.9.1

My understanding is I have to manually download & reference chrome version 114 - is that correct? I tried downloading & referencing it using driver_executable_path but no luck. Any suggestions?

Prakash2403 commented 1 year ago

@Spykerwolf Have you tried setting version_main=114 while initializing. E.g.

 driver = uc.Chrome(version_main=114, **kwargs)

version_main must match the version of chrome executable in your $PATH