尝试运行以下脚本以转至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 .. –