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
10.14k stars 1.17k forks source link

Binary Location Must be a string error #2094

Open MajesticMinhaz opened 5 days ago

MajesticMinhaz commented 5 days ago

This is my code


    # Set up the driver instance with options (including cookies)
    options = uc.ChromeOptions()
    # options.add_argument('--headless')
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-extensions")

    driver = uc.Chrome(options=options, driver_executable_path='./chromedriver')

and this is the error

Traceback (most recent call last):
  File "/home/minhaz/PycharmProjects/facebook-page-follower-scraper/scrap_followers.py", line 185, in <module>
    driver = uc.Chrome()
             ^^^^^^^^^^^
  File "/home/minhaz/PycharmProjects/facebook-page-follower-scraper/venv/lib/python3.11/site-packages/undetected_chromedriver/__init__.py", line 372, in __init__
    options.binary_location = (
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/minhaz/PycharmProjects/facebook-page-follower-scraper/venv/lib/python3.11/site-packages/selenium/webdriver/chromium/options.py", line 54, in binary_location
    raise TypeError(self.BINARY_LOCATION_ERROR)
TypeError: Binary Location Must be a String
marcinwrobel1986 commented 1 day ago

Hi, your binary location could be found with:

which chromedriver

add to your code:

    binary_location = '/usr/local/bin/chromedriver'
    options.binary_location = binary_location

it should work