Skip to content

Instantly share code, notes, and snippets.

@ultimate-qa2
Last active March 2, 2021 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ultimate-qa2/d93082fddd6b2ea8e2909ddfc862257f to your computer and use it in GitHub Desktop.
Save ultimate-qa2/d93082fddd6b2ea8e2909ddfc862257f to your computer and use it in GitHub Desktop.
@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