如何使用Python中的Selenium在Firefox中禁用Flash?

如何使用Python中的Selenium在Firefox中禁用Flash?,python,browser,selenium,selenium-webdriver,web-testing,Python,Browser,Selenium,Selenium Webdriver,Web Testing,尝试使用配置文件设置在Firefox中使用Python中的Selenium禁用Flash。指定一种通过GUI执行的方法,但是对于这个特定的用例,最好是以编程方式执行。具体来说,最好的解决方案是允许在新创建的配置文件对象中禁用闪存 非常感谢 您可以使用以下配置文件禁用闪存 from selenium.webdriver.firefox.firefox_profile import FirefoxProfile def disableImages(self): ## Fir

尝试使用配置文件设置在Firefox中使用Python中的Selenium禁用Flash。指定一种通过GUI执行的方法,但是对于这个特定的用例,最好是以编程方式执行。具体来说,最好的解决方案是允许在新创建的配置文件对象中禁用闪存


非常感谢

您可以使用以下配置文件禁用闪存

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

    def disableImages(self):
        ## Firefox profile object
        firefoxProfile = FirefoxProfile()

        ## Disable Flash
        firefoxProfile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so',
                                      'false')
        ## Set the modified profile while creating the browser object 
        self.browserHandle = webdriver.Firefox(firefoxProfile)

杰出的非常感谢你!您能否指定更多细节,如FF和selenium版本?