I am trying to use Selenium to open a headless Chrome browser in Python. I am using Chrome v84 and tried both Chromedriver v84 and v83. I am on Mac.
import selenium
from selenium import webdriver
path = r"path/to/chromedriver.exe"
op = webdriver.ChromeOptions()
op.add_argument('headless')
driver = webdriver.Chrome(executable_path = path, options=op)
I also tried this:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
op = webdriver.ChromeOptions()
op.add_argument('headless')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=op)
It returned:
ValueError: There is no such driver by url http://chromedriver.storage.googleapis.com/LATEST_RELEASE_64.0.3282
I also attempted to add Chromedriver to PATH and could check it was there by echo $PATH
, but it did not work.
I also tried running brew cask upgrade chromedriver
, after installing Chromedriver via homebrew, but it would only install Chromedriver v83 and the update command would only return something like "no updates available".
I also tried adding the path of Chromedriver under /usr/local/bin
by running sudo nano /etc/paths
in the terminal. Unfortunately, this time it didn't show up when running echo $PATH
, and as expected the Python script did not run successfully.
Any help regarding this will be greatly appreciated.