我第一次尝试硒webdriver。我已经更新到Python 3.6,我也重新安装了硒。试图打开一个基本的网页已经出错了。这里是代码:Python追溯错误的Selenium Webdriver
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.python.org")
这是非常基本的,但它仍然无法正常工作。它抛出了一些超出我解释能力的错误。当然,我试图用google搜索这个问题,似乎没有任何帮助。我会很感激任何输入。这些都是错误的:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Python36\lib\subprocess.py", line 707, in __init__restore_signals, start_new_session)
File "C:\Python36\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 "C:/Users/Will Pickard/PycharmProjects/Basics/Webdriver.py", line 3, in <module>
driver = webdriver.Firefox()
File "C:\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
self.service.start()
File "C:\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.
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x03801170>>
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 173, in __del__
self.stop()
File "C:\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 145, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'