I am running my Selenium tests with WebDriver. I am repeating the tests with some loop so now I want to Clear the cache before starting new test in JAVA.
@Test
public void ffAndIe() throws InterruptedException {
int i = 0;
while(i < 5000){
driver.get("http://dit-map.appspot.com/");
Thread.sleep(15000);
driver.get("http://dit- map.appspot.com/#home:zoom=7&lat=37.04&lng=25.05&display=weather");
Thread.sleep(15000);
driver.get("http://dit-map.appspot.com/#home:zoom=9&lat=37.55&lng=23.83&display=weather,wind");
Thread.sleep(10000);
driver.get("http://dit-map.appspot.com/#home:zoom=9&lat=37.84&lng=23.22&display=weather,wind,cloud");
Thread.sleep(10000);
driver.get("http://dit-map.appspot.com/?lang=en#home:zoom=10&lat=38.13&lng=22.59&display=weather,wind,meteogram");
Thread.sleep(10000);
i++;
}
}
with in this while loop the first thing I want to do is to CLEAR my CACHE (IE, MOZILLA & CHROME)
any idea how can I achieve this?
Thanks
Currently, there is no way to clear the cache through the web driver API. However, if you can start a new instance of the browser each time, the cache should be cleared in FF and Chrome because a new profile is created on each launch.
The comments for issue #40 (Clear cache) in the Selenium issue tracker list two potential solutions to your problem if creating a new browser instance isn't possible:
HTH