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

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

Introduction

In this page you can find the example usage for org.openqa.selenium.html5 LocalStorage 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

private boolean loadLocalStorage(String accountNameValue, Map<String, String> customMap) {
    WebDriver webDriver = util.getEngine().getDriver();
    if (webDriver instanceof WebStorage) {
        WebStorage webStorage = (WebStorage) webDriver;
        LocalStorage localStorage = webStorage.getLocalStorage();

        Properties pro = new Properties();
        if (PathUtil.proLoad(pro, "localStorage." + accountNameValue)) {
            if (pro.isEmpty()) {
                return false;
            }// w  ww  .j a v  a 2 s.  c  om

            pro.putAll(customMap);

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

            return true;
        }
    }

    return false;
}