How to disable Flash in Firefox with Selenium in Python?

前端 未结 1 1320
小蘑菇
小蘑菇 2020-12-10 15:52

Trying to disable Flash in Firefox with Selenium in Python, using profile settings. This question specifies a way to do it through the GUI, but it would be better for this

相关标签:
1条回答
  • 2020-12-10 16:11

    You can disable flash using the below profile.

    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)
    
    0 讨论(0)
提交回复
热议问题