1. 程式人生 > >splinter,selenium 找不到chromedriver

splinter,selenium 找不到chromedriver

使用splinter, chromedriver 放在當前目錄是可以找到的. 放在其他目錄就找不到了. 設定系統路徑也不行. 報錯如下:

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

解決方法:

增加 executable_path 引數即可:

from splinter import Browser

browser = Browser(driver_name='chrome', executable_path='../chromedriver')