Python selenium.common.exceptions.WebDriverException:消息:';chromedriver';可执行文件需要在路径中
我试图使用python和selenium自动化我的web应用程序,我面临以下问题 环境-Mac/Python/Selenium IDE-PyCharm selenium.common.exceptions.WebDriverException:消息:“chromedriver” 可执行文件需要在路径中。请看Python selenium.common.exceptions.WebDriverException:消息:';chromedriver';可执行文件需要在路径中,python,selenium,pycharm,selenium-chromedriver,Python,Selenium,Pycharm,Selenium Chromedriver,我试图使用python和selenium自动化我的web应用程序,我面临以下问题 环境-Mac/Python/Selenium IDE-PyCharm selenium.common.exceptions.WebDriverException:消息:“chromedriver” 可执行文件需要在路径中。请看 请帮助我解决此问题。是。因为您还没有传递Selenium驱动Chrome浏览器所需的Chrome二进制文件 您需要根据您的操作系统从以下URL下载二进制文件:- 使用以下代码:- imp
请帮助我解决此问题。是。因为您还没有传递Selenium驱动Chrome浏览器所需的Chrome二进制文件 您需要根据您的操作系统从以下URL下载二进制文件:- 使用以下代码:-
import os
from selenium import webdriver
chromedriver = "/Users/adam/Downloads/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver)
driver.get("http://stackoverflow.com")
更改上述代码中chromedriver的路径
或
或
或者,您可以使用直接路径连接到chromedriver,如下所示:
driver = webdriver.Chrome('/path/to/chromedriver')
资料来源:
您需要从页面下载
chromedriver
二进制文件,并将其放置在系统中的任何位置。当您启动WebDriver
实例时,您需要提到ChromeDriver
二进制文件的绝对路径
在我的Windows 8
系统上,以下代码块工作正常:
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
首先,你需要下载chrome驱动程序,然后将其解压。然后将此文件添加到环境参数中。然后写
driver=webdriver.Chrome('C:\YourPathofChromeDriver\chromedriver.exe')可能重复的,请阅读原因。粘贴代码并正确格式化。Shubham,我使用的是MAC环境。如果您费心向下滚动提供的链接,您会注意到:下载此:-在答案中添加另一个代码。。请参阅:-@ShubhamJain清楚地提到代码块是基于
Windows8
系统的。有人能帮我了解一下mac环境吗。@HillHacker你下载了依赖mac平台的chromedriver二进制版本2.32了吗?你能告诉我你存放它的位置吗?
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)