Example usage for org.openqa.selenium.html5 SessionStorage setItem

List of usage examples for org.openqa.selenium.html5 SessionStorage setItem

Introduction

In this page you can find the example usage for org.openqa.selenium.html5 SessionStorage setItem.

Prototype

void setItem(String key, String value);

Source Link

Usage

From source file:org.suren.autotest.web.framework.settings.AutoModuleProxy.java

License:Apache License

/**
 * sessionStorage?//w  ww  . ja va  2  s .  c o m
 * @param accountNameValue
 * @return
 */
private boolean loadSessionStorage(String accountNameValue, Map<String, String> customMap) {
    WebDriver webDriver = util.getEngine().getDriver();
    if (webDriver instanceof WebStorage) {
        WebStorage webStorage = (WebStorage) webDriver;
        SessionStorage sessionStorage = webStorage.getSessionStorage();

        Properties pro = new Properties();
        if (PathUtil.proLoad(pro, "sessionStorage." + accountNameValue)) {
            if (pro.isEmpty()) {
                return false;
            }

            pro.putAll(customMap);

            pro.stringPropertyNames().parallelStream().forEach((key) -> {
                sessionStorage.setItem(key, pro.getProperty(key));
            });

            return true;
        }
    }

    return false;
}