Protractor - empty local storage
local-storage, protractor
Solution
Another potential solution is to put any state clearing in an afterEach, which will run after any test is run: (see https://github.com/angular/protractor/issues/188)
afterEach(function() {
browser.executeScript('window.sessionStorage.clear();');
browser.executeScript('window.localStorage.clear();');
});
Problem
I'm using Protractor (with Jasmine) to test my AngulaJs application. As result of some of my action I get some data saved in the localStorage. Now I need to test other case, so I need to empty my storage (or better delete only some items) but If I try to run: ``` browser.executeScript('localStorage.removeItem("config");'); ``` I get the following error: ``` UnknownError: <unknown>: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs. (Session info: chrome=35.0.1916.153) (Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.9.2 x86_64) ``` Any idea on how to solve? Thanks in advance