'Install chromedriver on Mac M1 at specific location?

I just made the jump from Ubuntu to MacBook Air M1.

I am trying to set-up the system in a way that I don't have to change scripts for both. i.e. I want to keep the scripts in such a way that editing on either system is ok.

In a script I use the following line of code:

driver = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver")

I used Homebrew to install chromium-browser but I can't find the file (so I can move it to this location?).

I have tried almost everything I could look up and can't figure it out. What can I try next?



Solution 1:[1]

Install webdriver-manager, it allows you install and store chromedrive automatically

pip install webdriver-manager

and use like this:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())

Solution 2:[2]

The fastest way to to solve is using Home Brew:

brew install --cask chromedriver

Chromedriver will be installed in the correct path.

Solution 3:[3]

You can find the downloads for various versions of the Chrome driver here: https://chromedriver.chromium.org/downloads

For example, for v99 on Mac M1 you could download this archive: https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_mac64_m1.zip

Once downloaded just unzip & copy to whatever location you choose. After I installed I still needed to mark the application as "safe" in macOS, I followed the instructions here: https://stackoverflow.com/a/60362134/1371489

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vova
Solution 2 Rodrigo Simoes
Solution 3 jlhasson