路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法

一、模拟登陆网页时,使用了如下代码:
from selenium import webdriver
driver=webdriver.Chrome()

运行时一直报错:

Traceback (most recent call last):
  File "C:\Users\123\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Users\123\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\123\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

二、修改:

from selenium import webdriver

driver = webdriver.Chrome("D:/Program Files/360Chrome/Chrome/Application/360chrome.exe")

三、成功打开浏览器。

你可能感兴趣的:(python)