且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python selenium清除缓存和cookies

更新时间:2023-12-01 20:23:10

对于cookies使用'delete_all_cookies()'函数

for cookies use 'delete_all_cookies()' function

driver.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)