private BasicClientCookie duplicateCookie(Cookie seleniumCookie) { BasicClientCookie duplicateCookie = new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue()); duplicateCookie.setDomain(seleniumCookie.getDomain()); duplicateCookie.setAttribute(BasicClientCookie.DOMAIN_ATTR, seleniumCookie.getDomain()); duplicateCookie.setSecure(seleniumCookie.isSecure()); duplicateCookie.setExpiryDate(seleniumCookie.getExpiry()); duplicateCookie.setPath(seleniumCookie.getPath()); return duplicateCookie; } }
System.out.println("cookie = " + String.format("%s=%s",cookie.getName(), cookie.getValue()));
System.out.println("cookie = " + String.format("%s=%s",cookie.getName(), cookie.getValue()));
/** * {@inheritDoc} */ @Override public Cookie getCookieNamed(String name) { for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { return cookie; } } return null; }
@Override public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (name.equals(cookie.getName())) { return cookie; } } return null; }
public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (cookie.getName().equals(name)) { return cookie; } } return null; }
public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (cookie.getName().equals(name)) { return cookie; } } return null; }
public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (cookie.getName().equals(name)) { return cookie; } } return null; }
public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (name.equals(cookie.getName())) { return cookie; } } return null; }
public Cookie getCookieNamed(String name) { Set<Cookie> allCookies = getCookies(); for (Cookie cookie : allCookies) { if (cookie.getName().equals(name)) { return cookie; } } return null; }
@Override protected void describeMismatchSafely(WebDriver item, Description mismatchDescription) { mismatchDescription.appendText("was only "); List<String> cookNames = new LinkedList<>(); for (Cookie cook : item.manage().getCookies()) { cookNames.add(cook.getName()); } mismatchDescription.appendValueList("[", ", ", "]", cookNames); }
public void deleteCookie(Cookie cookie) { String currentUrl = getCurrentUrl(); try { URI uri = new URI(currentUrl); Cookie toDelete = new NullPathCookie(cookie.getName(), cookie.getValue(), uri.getHost(), uri.getPath(), new Date(0)); deleteCookieByPath(toDelete); } catch (URISyntaxException e) { throw new WebDriverException("Cannot delete cookie: " + e.getMessage()); } }
public void deleteCookie(Cookie cookie) { if (cookieManager == null) { throw new UnsupportedOperationException( "Deleting cookies are not supported without the cookie-manager service"); } cookieManager.removeCookie(cookie.getDomain(), cookie.getPath(), cookie.getName()); gc(); //Date dateInPast = new Date(0); Cookie toDelete = new Cookie(cookie.getName(), //cookie.getValue(), cookie.getDomain(), cookie.getPath(), dateInPast, false); //addCookie(toDelete); }
public void addCookie(Cookie cookie) { // TODO: Numeric overflow if (cookie.getExpiry() == null) { cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getDomain(), cookie.getPath(), new Date(new Date().getTime() + (10 * 365 * 24 * 60 * 60 * 1000)), false); } debugger.executeJavascript("document.cookie='" + cookie.toString() + "'", false); }
public void deleteCookie(Cookie cookie) { if (view == null) { throw new WebDriverException("No open windows."); } sessionCookieManager.remove(getCurrentUrl(), cookie.getName()); }
private void login() throws ProcessingException { loginToForm(); delayBeforeLoginCheckOrReattempt(); Cookie authCookie = getLoginToken(); if (authCookie == null) { throw new ProcessingException("Unable to acquire Cookie; check credentials."); } webCommunicationWrapper.getHttpRequestExecutor() .addCookie(authCookie.getName(), authCookie.getValue()); LOGGER.info("User has been authenticated"); }
public Set<Cookie> getCookies() { Set<Cookie> cookies = driver.manage().getCookies(); for (Cookie cookie : cookies) { LOG.keywordAppender().appendArgument(cookie.getName(), cookie.getValue()); } return cookies; }
private com.gargoylesoftware.htmlunit.util.Cookie convertSeleniumCookieToHtmlUnit(Cookie cookie) { return new com.gargoylesoftware.htmlunit.util.Cookie( cookie.getDomain(), cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getExpiry(), cookie.isSecure(), cookie.isHttpOnly() ); }
private void assertThatCookieContentIsIdentical(org.openqa.selenium.Cookie cookie, Cookie expectedCookie) { assertThat(cookie.getName(), is(expectedCookie.name)); assertThat(cookie.getValue(), is(expectedCookie.value)); assertThat(cookie.getDomain(), is(expectedCookie.domain)); assertThat(cookie.getPath(), is(expectedCookie.path != null ? expectedCookie.path : "/")); assertThat(cookie.getExpiry(), is(expectedCookie.expiry)); assertThat(cookie.isSecure(), is(expectedCookie.secure)); }
public void addCookie(Cookie cookie) { Page page = lastPage(); if (!(page instanceof HtmlPage)) { throw new WebDriverException("You may not set cookies on a page that is not HTML"); } // Cookies only make sense if the page is String domain = getDomainForCookie(cookie); verifyDomain(cookie, domain); webClient.getCookieManager().addCookie(new org.apache.commons.httpclient.Cookie(domain, cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getExpiry(), cookie.isSecure())); }