io.nosqlbench.driver.webdriver.verbs.CookieJar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-web Show documentation
Show all versions of driver-web Show documentation
A nosqlbench driver module;
Provides the ability to drive steps through the webdriver API.
package io.nosqlbench.driver.webdriver.verbs;
import org.openqa.selenium.Cookie;
import java.sql.Date;
import java.util.Map;
import java.util.Optional;
public class CookieJar {
public static Cookie cookie(Map props) {
String name = props.get("name");
String value = props.getOrDefault("value","");
Cookie.Builder builder = new Cookie.Builder(name, value);
Optional.ofNullable(props.get("domain")).ifPresent(builder::domain);
Optional.ofNullable(props.get("expiry")).map(Date::valueOf).ifPresent(builder::expiresOn);
Optional.ofNullable(props.get("ishttponly")).map(Boolean::valueOf).ifPresent(builder::isHttpOnly);
Optional.ofNullable(props.get("issecure")).map(Boolean::valueOf).ifPresent(builder::isSecure);
Optional.ofNullable(props.get("path")).ifPresent(builder::path);
return builder.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy