我正在尝试使用python和selenium自动化我的Web应用程序,我面临以下问题 .
环境 - Mac / Python / Selenium IDE - PyCharm
selenium.common.exceptions.WebDriverException:消息:'chromedriver'可执行文件需要在PATH中 . 请参阅https://sites.google.com/a/chromium.org/chromedriver/home
请帮我解决这个问题 .
我正在尝试使用python和selenium自动化我的Web应用程序,我面临以下问题 .
环境 - Mac / Python / Selenium IDE - PyCharm
selenium.common.exceptions.WebDriverException:消息:'chromedriver'可执行文件需要在PATH中 . 请参阅https://sites.google.com/a/chromium.org/chromedriver/home
请帮我解决这个问题 .
3 回答
在第一次,您需要从https://sites.google.com/a/chromium.org/chromedriver/downloads下载chrome驱动程序,然后取消归档 . 然后将此文件添加到环境中 . 然后写driver = webdriver.Chrome('C:\YourPathofChromeDriver\chromedriver.exe')
是 . 因为你没有通过selenium所需的chrome二进制文件来驱动你的chrome浏览器 .
您需要根据您的操作系统从以下URL下载二进制文件: -
https://chromedriver.storage.googleapis.com/index.html?path=2.32/
使用以下代码: -
在上面的代码中改变了chromedriver的路径
要么
要么
或者,你可以像这样使用chromedriver的直接路径:
资源 :-
Running Selenium WebDriver python bindings in chrome
希望它能帮到你:)
您需要从ChromeDriver Download页面下载
chromedriver
二进制文件并将其放在系统中的任何位置 . 在启动 WebDriver 实例时,需要提及 ChromeDriver 二进制文件的绝对路径 .在我的
Windows 8
系统上,以下代码块完美运行: