嘗試運行以下腳本以轉至this網站,然後單擊鏈接以導出csv。使用Python單擊按鈕腳本
from selenium import webdriver
driver=webdriver.Firefox()
driver.get("https://www.draftkings.com/contest/gamecenter/46877680")
elem1 = driver.find_element_by_link_text("Export Lineups to CSV")
elem1.click()
我碰到下面的錯誤,並不能找到一個geckodriver
。我點安裝硒。我從一個較舊的視頻中獲得了該視頻,並且我目前運行Python 3.6
,因此這可能也是問題的一部分。我哪裏錯了?
Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Program Files\Python36\lib\subprocess.py", line 707, in init restore_signals, start_new_session) File "C:\Program Files\Python36\lib\subprocess.py", line 992, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
在處理上述異常,另一個異常:
Traceback (most recent call last): File "C:/Users/mike/Desktop/Lineup1.py", line 2, in driver=webdriver.Firefox() File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 144, in init self.service.start() File "C:\Program Files\Python36\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: 'geckodriver' executable needs to be in PATH.
當你收到一條你不明白的錯誤信息時,你應該做的第一件事就是Google。這通常會找到你至少可以開始的答案。 – JeffC
這就是我如何堆棧溢出Jeff .. –