问题描述
我使用selenium 3与Firefox 50.1.0进行交互
当我运行 driver.quit()
Firefox关闭浏览器时出错
driver.close()
根本不工作
这是版本问题吗?如果是的话,我应该在Firefox安装哪个版本
from selenium import webdriver $ b $ from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\程序文件(x86)\ Mozilla Firefox \ Firefox.exe')
驱动程序= webdriver.Firefox(firefox_binary =二进制)
驱动程序。 quit()
尝试降级firefox:
尝试使用不同的驱动程序,chrome,edge,IE,opera。
基本上,尝试将硒与驱动程序一起降级,直到找到一个版本这可能是 selenium == 2.53.6
和 firefox == 46.x
一旦您找到可以正常运行的版本,请务必保存已关闭自动更新的配置文件,然后使用它,或者每次关闭它。
from selenium import webdriver
$ b $ profile = webdriver.FirefoxProfile()
profile.set_preference('app.update.auto',False )
profile.set_preference('app.update.enabled',False)
profile.set_preference('app.update.silent',False)
downgraded_firefox ='C:\程序文件(x86)\ Mozilla Firefox \Firefox.exe'
binary = webdriver.FirefoxBinary(downgraded_firefox)
driver = webdriver.Firefox(profile,firefox_binary = binary)
$ c $
$ b
如果您点击查看问题详情
的弹出,你可能会发现类似的信息,为什么firefox坠毁。请参阅:
-
-
-
相关: p>
-
i am using selenium 3 to interact with Firefox 50.1.0
while i am running driver.quit()
Firefox gives error while closing the browser
driver.close()
is not working at all
is this a version issue ? if yes which version should i install in Firefox
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
driver.quit()
解决方案 Try to downgrade firefox:
- https://ftp.mozilla.org/pub/firefox/releases/
- https://ftp.mozilla.org/pub/firefox/releases/49.0b9/win64/en-US/
- https://ftp.mozilla.org/pub/firefox/releases/49.0b9/win32/en-US/
Try using a different driver, chrome, edge, IE, opera.
Basically, try downgrading selenium along with the drivers until you find a version that works possibly selenium==2.53.6
and firefox==46.x
Once you find a version that works, be extra sure to save a profile that has autoupdate turned off, and then use it, or just turn it off everytime:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('app.update.auto', False)
profile.set_preference('app.update.enabled', False)
profile.set_preference('app.update.silent', False)
downgraded_firefox = 'C:\Program Files (x86)\Mozilla Firefox\Firefox.exe'
binary = webdriver.FirefoxBinary(downgraded_firefox)
driver = webdriver.Firefox(profile, firefox_binary=binary)
See example of profiles:
- Setting selenium to use custom profile, but it keeps opening with default
- Stopping auto update of Mozilla Firefox
If you click on View problem details
of the popup, you might find similar information on why firefox crashed. See:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1027222
- https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7506
- https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3314
Related:
这篇关于driver.quit在硒3.0.2 Firefox 50.1.0 Firefox已停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!