本文介绍了driver.quit在硒3.0.2 Firefox 50.1.0 Firefox已停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用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)



$ 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:

    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:

    If you click on View problem details of the popup, you might find similar information on why firefox crashed. See:

    Related:

    这篇关于driver.quit在硒3.0.2 Firefox 50.1.0 Firefox已停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    07-31 22:30