Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Test
public void cIsForCookie() {
driver.get("http://example.com");
Cookie cookie = new Cookie.Builder("name", "value")
.domain("example.com")
.expiresOn(new Date(2025,10,31))
.isHttpOnly(true)
.isSecure(false)
.path("/myPath")
.build();
driver.manage().addCookie(cookie);
driver.get("http://example.com/mypath");
Cookie found = driver.manage().getCookieNamed("name");
assertEquals("value", found.getValue());
driver.manage().deleteAllCookies();
assertFalse(driver.manage().getCookies().contains(found));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment