user3518405
user3518405

Reputation: 45

Disable cache on network tab using python selenium(automation)

I need to disable cache on network tab using selenium python . tried below ways but nothing worked

   options = webdriver.ChromeOptions()
            options.add_argument("--incognito")
            options.add_argument('--disable-application-cache')
            options.add_argument("--disk-cache-size=0")
            options.add_argument("--disk-cache-dir=/dev/null")
            options.add_argument("--disable-gpu")
            d = DesiredCapabilities.CHROME
            d['goog:loggingPrefs'] = {'browser': 'ALL'}

Upvotes: 1

Views: 4624

Answers (1)

PDHide
PDHide

Reputation: 19989

driver.execute_cdp_cmd("Network.setCacheDisabled", {"cacheDisabled":True})

use chrome dev protocol , see if this helps

https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCacheDisabled

Upvotes: 4

Related Questions