It is important to check session and local storage while testing web browser functionalities.

As part of test automation, sometimes we feel the need of getting certain data from session or local storage.


For example: access token can be obtained from the browser session or local storage.



Here is snippet code using Augmenter in Selenium
WebDriver driver = new ChromeDriver();
WebStorage webStorage = (WebStorage) new Augmenter().augment(driver);
// Local storage
LocalStorage localStorage = webStorage.getLocalStorage();
localStorage.getItem("access_token");

// Session storage
SessionStorage sessionStorage = webStorage.getSessionStorage();
sessionStorage.getItem("access_token");