2

is there a way to clear cache and cookies using javascript? I am using selenium to run tests in microsoft edge and the tests run in the same session as the previous run (not a new session). Need to figure out how to run on a clean session each time. Right now, there does not seem to be any support in selenium for this.

Chris Hansen
  • 7,813
  • 15
  • 81
  • 165
  • You can't clear httpOnly cookies from inside browser....they are protected Question depends on how you set cookies – charlietfl Oct 04 '16 at 01:17

2 Answers2

0

To clear one cookie use this, to clear all cookies use this. You can't clear cache but you can append a version number like its mentioned on this

Community
  • 1
  • 1
Aschab
  • 1,378
  • 2
  • 14
  • 31
0

For Chrome and Firefox, I always used Watir's browser.cookies.clear http://www.rubydoc.info/gems/watir-webdriver/Watir/Cookies

However, I noticed that this did not work on Edge for some reason. So I'm waiting for an answer on this topic (might help you as well) https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14838528/

adiga
  • 34,372
  • 9
  • 61
  • 83
Mark Duivesteijn
  • 183
  • 1
  • 12