I am trying web scrapping with selenium and therefore following the below code. However, I encounter an error with chromedriver path, I am unable to figure out on mac M1. I've tried several methods to solve this.
Any hints?
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
chromeOptions = Options()
chromeOptions.headless = False
s = Service("usr/local/bin/chromedriver")
driver = webdriver.Chrome(service= s, options = chromeOptions )
I am getting the below error:
---------------------------------------------------------------------------
SeleniumManagerException Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in start(self)
95 try:
---> 96 path = SeleniumManager().driver_location(browser)
97 except WebDriverException as new_err:
7 frames
SeleniumManagerException: Message: Selenium manager failed for: /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome. /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager)
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in _start_process(self, path)
210 except OSError as err:
211 if err.errno == errno.ENOENT:
--> 212 raise WebDriverException(
213 f"'{os.path.basename(self.path)}' executable needs to be in PATH. {self.start_error_message}"
214 )
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
You need to provide also the file name of the webdriver in the path, so in your case:
usr/local/bin/chromedriver
should be like:
usr/local/bin/chromedriver/chromedriver
if the name of the folder matches the webdriver file name. At least according to the error it seems like chromedriver is a folder where you have placed the real webdriver file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.