2017-03-11 437 views
0

找過答案,但找不到任何東西。這似乎堅持上說,它不能找到指定的文件,然後檢查路徑,但無法看到它甚至然後:/我已經把目錄路徑:http://imgur.com/a/ZP59wChromedriver:「FileNotFoundError:[WinError 2]系統找不到指定的文件」錯誤

計劃:

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

錯誤:

Traceback (most recent call last): 
    File "C:\Users\dilri\AppData\Local\Programs\Python\Python36-32\lib\site-  packages\selenium\webdriver\common\service.py", line 74, in start 
    stdout=self.log_file, stderr=self.log_file) 
    File "C:\Users\dilri\AppData\Local\Programs\Python\Python36- 32\lib\subprocess.py", line 707, in __init__ 
    restore_signals, start_new_session) 
    File "C:\Users\dilri\AppData\Local\Programs\Python\Python36-  32\lib\subprocess.py", line 990, in _execute_child 
    startupinfo) 
FileNotFoundError: [WinError 2] The system cannot find the file specified 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "H:\temp.py", line 2, in <module> 
    driver = webdriver.Chrome() 
    File "C:\Users\dilri\AppData\Local\Programs\Python\Python36-32\lib\site- packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__ 
    self.service.start() 
    File "C:\Users\dilri\AppData\Local\Programs\Python\Python36-32\lib\site- packages\selenium\webdriver\common\service.py", line 81, in start 
    os.path.basename(self.path), self.start_error_message) 
selenium.common.exceptions.WebDriverException: Message: 'chromedriver'  executable needs to be in PATH. Please see  https://sites.google.com/a/chromium.org/chromedriver/home 

如果有人能幫助,將不勝感激。

回答

0

你可以嘗試直接傳遞它的路徑。

所以,我有我的dekstop的webdriver的文件,以便:

webdriver.Chrome('C:/Users/adam/Desktop/chromedriver.exe') 

你可以得到的webdriver here.

相關問題