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