I'm looking for a way to completely delete all cookies, session/state cookies, storage, etc. using Protractor. Basically, I want to accomplish the same thing in Protractor as a user would by going to Settings -> Clear browsing data.
browser.manage().deleteAllCookies()
does not delete httpOnly cookies. And since JavaScript can't touch httpOnly cookies, I can't use JavaScript.
I know I could restart the browser in Protractor, but prefer not to go this route.
Any suggestions?
This answer by Anthony Panozzo was the best way for me to clear session and local storage (https://stackoverflow.com/a/25678498/5072980)
afterEach(function() {
browser.executeScript('window.sessionStorage.clear();');
browser.executeScript('window.localStorage.clear();');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With