Начал изучать библиотеку selenium для python3 и столкнулся с проблемой.
>>>from selenium import webdriver
>>>driver=webdriver.Firefox()
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x01B6FBD0>>
Traceback (most recent call last):
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
self.stop()
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
Traceback (most recent call last):
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Не удается найти указанный файл
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Users\Defernus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Весь день убил, а так и не понял, как решить.
geckodriver
не найден—есть ли у вас на машинеgeckodriver.exe
и находится ли его папка в%PATH%
? – jfs 22 окт '16 в 7:37.exe
на конце? Попробуйте запустить командуsubprocess.Popen()
как она указана в service.py на 64 строке. – jfs 23 окт '16 в 5:41