How to clear browser cache in protractor

849 views Asked by At

I want to validate css color change in my e2e using protractor. I can see the color is changed in DB, but it is not reflecting in the UI, I tried to clear the cache using

browser.actions().keyDown(protractor.Key.CONTROL).sendKeys(protractor.Key.F5).perform();

but still it is not bringing up the changes.

How can I achieve this?

1

There are 1 answers

7
Bharath Kumar S On
browser.manage().deleteAllCookies().then(() => { console.log("cleared") } );

Add this to your test.

For clearing local storage

browser.executeScript('window.localStorage.clear();')