Possible to disable firefox and chrome default caching?

后端 未结 2 1857
不知归路
不知归路 2020-12-11 03:10

I\'m having a problem with firefox caching, when i change a site redirection firefox decides that it needs to cache this.

The point is I wan\'t to create a test that

相关标签:
2条回答
  • 2020-12-11 03:46

    To disable chrome caching:

    from selenium import webdriver
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument('--disable-application-cache')
    driver = webdriver.Chrome(chrome_options=chrome_options)
    

    List of available command-line arguments you can see here.

    0 讨论(0)
  • 2020-12-11 03:56

    Take a look at this page: http://code.google.com/p/selenium/issues/detail?id=40

    To disable Firefox caching you can try: Create a new profile with firefox.exe -ProfileManager

    Go to the Firefox profile directory and add the following to prefs.js:

    user_pref("browser.cache.disk.enable", false);
    user_pref("browser.cache.memory.enable", false);
    user_pref("browser.cache.offline.enable", false);
    user_pref("network.http.use-cache", false);
    

    Tell Selenium to use the custom Firefox profile (This is Java):

    ProfilesIni allProfiles = new ProfilesIni();
    FirefoxProfile profile = allProfiles.getProfile("Selenium");
    FirefoxDriver browser = new FirefoxDriver(profile);
    
    0 讨论(0)
提交回复
热议问题