我正在尝试清除我的 firefox 浏览器中的缓存和 cookie,但我无法让它工作。我已经搜索过了,我只得到了 java 和 C# 的解决方案。如何在 Python 中清除缓存和 cookie?
Selenium 版本:3.6.0
平台:python
python 版本:2.7.8
网络驱动程序:壁虎驱动程序
浏览器平台:Firefox
最佳答案
对于 cookie 使用 'delete_all_cookies()' 函数
driver.delete_all_cookies()
用于缓存创建配置文件
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.cache.disk.enable", False)
profile.set_preference("browser.cache.memory.enable", False)
profile.set_preference("browser.cache.offline.enable", False)
profile.set_preference("network.http.use-cache", False)
driver =webdriver.Firefox(profile)
关于python selenium清除缓存和cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46529761/