selenium firefox 内存 速度优化

selenium firefox 内存 速度优化

2 23         profile = webdriver.FirefoxProfile()                                     
2 24         profile.set_preference("permissions.default.image", 2)                   
2 25         # 禁用浏览器缓存                                                         
2 26         profile.set_preference("network.http.use-cache", False)                  
2 27         profile.set_preference("browser.cache.memory.enable", False)             
2 28         profile.set_preference("browser.cache.disk.enable", False)               
2 29         profile.set_preference("browser.sessionhistory.max_total_viewers", 3)    
2 30         profile.set_preference("network.dns.disableIPv6", True)                  
2 31         profile.set_preference("Content.notify.interval", 750000)                
2 32         profile.set_preference("content.notify.backoffcount", 3)                 
2 33                                                                                  
2 34         # 有的网站支持   有的不支持                                              
2 35         profile.set_preference("network.http.pipelining", True)                  
2 36         profile.set_preference("network.http.proxy.pipelining", True)            
2 37         profile.set_preference("network.http.pipelining.maxrequests", 32)  

with Firefox(executable_path=FIREFOX_PATH, timeout=60, firefox_options=self._options, firefox_profile=self._profile) as driver:
    pass
posted @ 2019-06-23 11:42  ABeen  阅读(2059)  评论(0编辑  收藏  举报