我正在使用:
我的代码:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary=FirefoxBinary('C:\Program Files\Mozilla Firefox\firefox.exe')
wb=webdriver.Firefox(firefox_binary=binary)
wb.get("www.python.org")
错误讯息:
wb=webdriver.Firefox(firefox_binary=binary) File "c:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__ keep_alive=True) File "c:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "c:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "c:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute self.error_handler.check_response(response) File "c:\Python34\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Failed to start browser: entity not found
答案 0 :(得分:4)
将firefox更新为> = 48以运行selenium3
https://ftp.mozilla.org/pub/firefox/releases/49.0.2/win64/en-GB/Firefox%20Setup%2049.0.2.exe
答案 1 :(得分:2)
发现问题可能是一个错误 在geckodriver.log中,我注意到firefox.exe的调用方式有些奇怪
1478478477543 geckodriver :: marionette INFO启动浏览器C:\ Program 文件(x86)\ Mozilla Firefoxirefox.exe
当我将firefox路径从firefox.exe更改为大写F Firefox.exe时。每个人都在工作
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')