Testing sessionStorage using JS executor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set item value | |
public void setItem(String itemName, String itemValue) { | |
((JavascriptExecutor) driver).executeScript("window.sessionstorage.setitem(itemName, itemValue)"); | |
} | |
//Get item value | |
public String getItem(String itemValue) { | |
return (String) ((JavascriptExecutor) driver).executeScript(String.format( | |
"return window.sessionstorage.getItem('%s');", itemValue)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment