2017-06-16 183 views
0

python代碼無法找到geckodriver。FireFox webdriver錯誤

import time 
from selenium import webdriver 
browser=webdriver.Firefox('D:/Folder_1/chrome_driver/geckodriver_win32/geckodriver.exe') 

錯誤:WindowsError:[錯誤267]的目錄名稱是無效的:'d:/Folder_1/chrome_driver/geckodriver_win32/geckodriver.exe/ '

+2

只有2個反斜槓,** 'd:\\ geckodriver.exe' **如果在Windows – Stack

+0

actaul路徑爲:d:/Folder_1/chrome_driver/geckodriver_win32/geckodriver.exe – karthi

+0

做到這一點 'browser = webdriver.Firefox('D:\\ Folder_1 \\ chrome_driver \\ geckodriver_win32 \\ geckodriver.exe')' – Stack

回答

1

如果在窗口中,則需要在您的sys路徑中添加geckodriver.exe路徑。和 期運用

from selenium import webdriver 
bow = webdriver.Firefox()