Access Local Storage

To access local storage use browser.localStorage .Lets consider a simple web page that displays a value from a local storage. <div id="favorite-color"> </div> <script> const element = document.getElementById('favorite-color'); element.innerHTML = localStorage.getItem('favoriteColor'); </script> package scenarios.ui import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* scenario("local storage api") { browser.open('/local-storage') browser.localStorage.setItem('favoriteColor', 'clean') def color = $('#favorite-color') browser.reopen('/local-storage') color.should == 'clean' browser.localStorage.clear() browser.reopen('/local-storage') color.should == '' } public String getItem(String key) public void setItem(String key, String value) public void removeItem(String key) public void clear() public int size()