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
原文地址:https://www.cnblogs.com/abeen/p/11072203.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。