使用 selenium 的 chromedriver 路径问题与 Google Collab on Windows
Problem with the path of chromedriver using selenium with Google Collab on Windows
我在 Windows.
上安装了 selenium 和 chromedriver
我在 /Windows/System32 中复制了 chromedriver 名称完整路径 /Windows/System32/chromium-browser/chromedriver.
然后我写道:
driver = webdriver.Chrome("/Windows/System32/chromium-browser/chromedriver")
我也试过在/Windows前面写C:,也试过在"C:/..."前面写r,都没有解决问题。
但我收到此错误消息:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我检查了我在系统变量中添加了 chrome driver :
PS:当我使用 Jupyter Notebook 而不是 Google Collaboratory
时,不会发生错误
driver = webdriver.Chrome("/Windows/System32/chromium-browser/chromedriver")
windows chromedriver 是一个 exe 文件,所以上面的文件是错误的你应该使用像
这样的东西
driver = webdriver.Chrome(executable_path="C:/Windows/System32/chromium-browser/chromedriver.exe")
确保您下载了正确的版本,并使用 executable_path= 参数名称
我在 Windows.
上安装了 selenium 和 chromedriver我在 /Windows/System32 中复制了 chromedriver 名称完整路径 /Windows/System32/chromium-browser/chromedriver.
然后我写道:
driver = webdriver.Chrome("/Windows/System32/chromium-browser/chromedriver")
我也试过在/Windows前面写C:,也试过在"C:/..."前面写r,都没有解决问题。
但我收到此错误消息:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我检查了我在系统变量中添加了 chrome driver :
PS:当我使用 Jupyter Notebook 而不是 Google Collaboratory
时,不会发生错误driver = webdriver.Chrome("/Windows/System32/chromium-browser/chromedriver")
windows chromedriver 是一个 exe 文件,所以上面的文件是错误的你应该使用像
这样的东西driver = webdriver.Chrome(executable_path="C:/Windows/System32/chromium-browser/chromedriver.exe")
确保您下载了正确的版本,并使用 executable_path= 参数名称