1,安装selenium
pip3 install selenium
使用dirver = webdriver.Chrome()时会报错:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
2.安装chromedriver:
brew install chromedriver
可能会卡在Updating Homebrew...,ctrl+c
多试几次哦!
brew 升级好了后!
报: Error: No available formula with the name "chromedriver"
Found a cask named "chromedriver" instead.
现在用下面命令重装chromedriver
brew cask install chromedriver
==> Verifying SHA-256 checksum for Cask 'chromedriver'.
==> Installing Cask chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'. # 成功解决之前的报错(needs to be in PATH)
? chromedriver was successfully installed!
In [1]: from selenium import webdriver
In [2]: dirver = webdriver.Chrome()
In [3]:
这样就成功了!!! Mac 给力 brew 也很给力!!!!