MacOS 更新ChromeDriver

有时我们会遇到这样的场景:chrome浏览器自动更新到最新版本,而我们本地seleium自动化所使用的ChromeDriver没有同步更新,导致在运行自动化脚本时,会报如下的错误

Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

这时我们只需要重新安装ChromeDriver即可 brew cask reinstall chromedriver

$  brew cask reinstall chromedriver
==> Downloading https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_mac64.zip
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'chromedriver'.
==> Uninstalling Cask chromedriver
==> Unlinking Binary '/usr/local/bin/chromedriver'.
==> Purging files for version 77.0.3865.40 of Cask chromedriver
==> Installing Cask chromedriver
==> Linking Binary 'chromedriver' to '/usr/local/bin/chromedriver'.
  chromedriver was successfully installed!

注意:
下面这个命令只适合第一次安装chromedriver,
brew tap homebrew/cask && brew cask install chromedriver
需要更新chromedriver时,请使用上面第一条命令

你可能感兴趣的:(MacOS 更新ChromeDriver)