4
我最近下载的硒,并试图运行此脚本:蟒蛇的webdriver eror
from selenium import webdriver
driver = webdriver.Firefox()
,但我得到这个错误:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
driver = webdriver.Firefox()
File "C:\Heights\PortableApps\PortablePython2.7.6.1\App\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
keep_alive=True)
File "C:\Heights\PortableApps\PortablePython2.7.6.1\App\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Heights\PortableApps\PortablePython2.7.6.1\App\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Heights\PortableApps\PortablePython2.7.6.1\App\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "C:\Heights\PortableApps\PortablePython2.7.6.1\App\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'firefox_binary' capability provided, and no binary flag set on the command line
哦,顺便说一下这个打开我面前geckodriver.exe其写错误
并且您是否安装了Firefox?你有没有试过告诉Selenium它在哪?如果你使用的是便携式应用,他们可能会把事情放在非传统的地方,这会破坏东西。 – jonrsharpe
感谢评论,我安装了fire fox,我怎么告诉硒在哪里?我使用便携式应用程序,你认为我应该删除它,并没有它下载python? – omersk
你正在使用哪个版本的Firefox? – Piyush