需要跑个web动态扫描, mac权限和chrome版本有多坑。

    在2021年9.29,我的chrome是96,但是chromeDriver只支持到93…

    如果你有问题:

    [

    ](https://sites.google.com/a/chromium.org/chromedriver/home)
    selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

    你需要下一个chromedriver, 一定要注意和你的chrome浏览器版本匹配, 不然还会报一个binary chrome 不匹配错误。

    如果你不想全局安装的话,可以把chromedriver放到任意文件夹,然后:

    1. from selenium.webdriver.remote.webdriver import WebDriver
    2. chrome_options = webdriver.ChromeOptions()
    3. driver = webdriver.Chrome(executable_path="/your_path/chromedriver", chrome_options = chrome_options)

    如果你不想使用默认chrome浏览器,可以下个对应版本的chromium, 然后声明一下路径:

    1. chrome_options = webdriver.ChromeOptions()
    2. chrome_options.binary_location = "/your_path/Chromium.app/Contents/MacOS/Chromium
    3. driver = webdriver.Chrome(executable_path="/your_path/chromedriver", chrome_options = chrome_options)

    有效解决: https://stackoverflow.com/questions/46026987/selenium-gives-selenium-common-exceptions-webdriverexception-message-unknown

    注意: MacOS下,要给Chromium和chromedriver权限~!