简体   繁体   English

当我尝试将Selenium与python结合使用以打开Chrome浏览器时,Windows给我一个FileNotFoundError:[WinError 2]

[英]When I try to use Selenium with python to open a Chrome browser, windows gives me a FileNotFoundError: [WinError 2]

Here is my code: 这是我的代码:

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.google.com/")

Then in windows PowerShell I get: 然后在Windows PowerShell中,我得到:

PS C:\Users\userName\PycharmProjects\untitled> python .\s_Chrome.py
Traceback (most recent call last):
File "C:\Users\userName\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-2.49.2-py3.5.egg\selenium\webdriver\common\service.py", line 62,
in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\userName\AppData\Local\Programs\Python\Python35-32\lib\subproce
ss.py", line 950, in __init__
restore_signals, start_new_session)
File "C:\Users\userName\AppData\Local\Programs\Python\Python35-32\lib\subproce
ss.py", line 1220, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Do I need to add something to PATH? 我需要在PATH中添加一些内容吗?

You need to have the chromedriver executable in your PATH . 您需要在PATH具有chromedriver可执行文件。 Go here to get more information and to download chromedriver for various platforms. 转到此处以获取更多信息并下载适用于各种平台的chromedriver。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 [WinError 2] python Selenium webDriver中的FileNotFoundError - [WinError 2]FileNotFoundError in python Selenium webDriver 如果我尝试使用 Python/Selenium 打开它,Chrome 会崩溃 - Chrome crashes if I try to open it with Python/Selenium 当我尝试运行我的烧瓶/python 应用程序时,它给了我错误:A secret key is required to use CSRF - when I try to run my flask/python application it gives me the error: A secret key is required to use CSRF 当我尝试连接-python时,套接字给我错误 - Socket gives me error when i try to connect -python Python selenium给出数据; 在 Chrome 浏览器中 - Python selenium gives data; in Chrome browser 当我尝试使用.open时,Python Mechanize一直给我'response_seek_wrapper' - Python Mechanize keeps giving me 'response_seek_wrapper' when I try to use .open 使用 Python 启动和跟踪 Chrome 浏览器(在 Windows 上),打开新标签页,然后在完成后关闭所有内容 - Use Python to launch and track Chrome browser (on Windows), open new tabs, then close everything when done FileNotFoundError:[WinError 2] python 3.4 - FileNotFoundError: [WinError 2] python 3.4 Python - 子进程 FileNotFoundError: [WinError 2] - Python - subprocess FileNotFoundError: [WinError 2] subprocess python filenotfounderror:[winerror 2] - subprocess python filenotfounderror: [winerror 2]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM