Search code examples
selenium-webdriverselenium-chromedriverselenium-edgedriverclear-cache

How to clear cache in Edge/Chrome (Shaft engine & Selenium 4.0) Java


I was facing a problem that a web page is always cached when am trying to run an automation script on it however manually its working fine so I'm trying to clear http cache I already did it for Firefox but now I'm trying to clear it for Edge and Chrome browser as they are both using same engine and I tried all possible (available) solutions, but I wasn't able to clear the cache. I even tried to run incognito mode and the page was still cached. I don't know how to approach this issue. Can someone give me any idea how to do this? thanks a lot.

Note: I'm using shaft engine so am not able to use dev tools to clear cache.

I tried the following: (Java language)

  • adding option --disk-cache-dir=NUL
  • adding option --disk-cache-size=0
  • adding option --media-cache-dir =NUL
  • adding option --media-cache-size =0
  • adding option --disable-gpu
  • Deleting the cache folder and using default profile attached with this cache folder

Solution

  • To give an update on the mentioned question, I solved it using dev tools api.