6

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
Sid
  • 3,749
  • 7
  • 29
  • 62

3 Answers3

8

The fastest way to to solve is using Home Brew:

brew install --cask chromedriver

Chromedriver will be installed in the correct path.

  • 1
    FWIW after install via `brew` I still needed to mark the application as "safe" in macOS, I followed the instructions here: https://stackoverflow.com/a/60362134/1371489 – jlhasson Mar 29 '22 at 00:25
7

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())
Vova
  • 3,117
  • 2
  • 15
  • 23
1

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

jlhasson
  • 1,516
  • 1
  • 15
  • 23