Re: chromdriver clear cache before each request

2,775 views
Skip to first unread message

Vic11

unread,
Mar 5, 2013, 10:44:14 AM3/5/13
to webd...@googlegroups.com
After further investigation, I managed to figure this out in an unconventional way. It seems that chromedriver does not provide a way to clear the cache programmatically. Most of the suggestions revolved around setting the switch "disk-cache-size=1" and running chrome in "incognito". Both of these did not work for me. 
The solution that I came up with was to load chrome with the extension - "CacheKiller" . Unfortunately, this extension requires clicking on it to enable. I had to modify the Background.js file to disable caching by default and pack the extension. 

Hope this helps someone out.

On Tuesday, February 26, 2013 9:19:03 AM UTC-5, Vic11 wrote:
Hi Guys,

In one of my tests, I need to clear the cache before each webdriver .navigate() . I tried initializing chromedriver with the following switches, but it is still caching some resources like - js and css files. Would appreciate it if someone could point me in the right direction.

ChromeOptions Chromeoptions = new ChromeOptions();
 Chromeoptions.AddArguments("disable-application-cache");
  Chromeoptions.AddArguments("disk-cache-size=0");
 _driver = new ChromeDriver(CHROMEDRIVER_PATH, Chromeoptions);

damien...@gmail.com

unread,
Jun 17, 2013, 5:07:21 PM6/17/13
to webd...@googlegroups.com
Hi,

Do you have some news about this topic ? Installing an extension is not an option in my case.
I try to specify a disk-cache-dir argument with a non-writable directory... no effect.

Does anybody have an idea ?
Reply all
Reply to author
Forward
0 new messages