Replies: 2 comments 2 replies
|
Hey! I ran into this exact same issue last week, so I feel your pain 😊 Problembasically, Quick Fixes1. Let it handle everything automatically (recommended)import undetected_chromedriver as uc
driver = uc.Chrome(use_subprocess=True)
driver.get("https://www.google.com")
# no manual paths2. Force it to match your Chrome versionif auto-detection fails: import undetected_chromedriver as uc
driver = uc.Chrome(version_main=142, use_subprocess=True)
driver.get("https://www.google.com")3. Update Chrome to 143go to 4. Nuclear option - fresh installpip uninstall undetected-chromedriver
pip cache purge # clear cached versions
pip install undetected-chromedriver --no-cache-dirPro Tips from the Trenchesthe dont mess with manual paths unless you absolutely have to: # error
driver = uc.Chrome(driver_executable_path="/chromedriver")
# do this instead
driver = uc.Chrome(use_subprocess=True)if Chrome keeps closing instantly, try these options: import undetected_chromedriver as uc
options = uc.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-blink-features=AutomationControlled')
driver = uc.Chrome(options=options, use_subprocess=True)check your Chrome installation path - sometimes undetected_chromedriver cant find Chrome if its installed in a no-standard location: import undetected_chromedriver as uc
# for windows with custom location
options = uc.ChromeOptions()
options.binary_location = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
driver = uc.Chrome(options=options, use_subprocess=True)Why This Happenschrome auto-updates in the background like an overachiever, but ChromeDriver releases lag behind by a few days/weeks. the Related IssuesCheck out these similar discussions: My Setup (for reference)when I fixed this issue, here's what worked for me: import undetected_chromedriver as uc
import time
options = uc.ChromeOptions()
options.add_argument('--start-maximized')
driver = uc.Chrome(options=options, use_subprocess=True, version_main=142)
try:
driver.get("https://www.google.com")
time.sleep(5) # give it a moment to load
print("Success! Chrome is running.")
except Exception as e:
print(f"Error: {e}")
finally:
# driver.quit()
passlet me know which solution worked for you! Would love to hear if you found a different fix too 👍 |
|
My setup: I tried just adding the use_subprocess=True, but for me that didn't resolve the incompatible version problem. I still saw: For sure, the first approach should be to just update your Chrome Browser version to the latest. ("..." -> Help -> About Google Chrome. Restart if it updates). If you're lucky, it will update to the next major version number, which presumably will match the ChromeDriver version. (Previously, zektrace explained that ChromeDriver often updates to a new major version earlier (by a few days or longer) than the Chrome Browser updates). I was forced to also add the "version_main=145" to match my current installed Chrome Browser. However, it sucks to use a hard-coded number that won't stay current, so I wrote a simple function to extract the (integer) 145, then include it as an option: I am only a python novice, but this works for me. Comments/improvements welcome. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone,
All reactions