List of usage examples for org.openqa.selenium Cookie Cookie
public Cookie(String name, String value, String domain, String path, Date expiry)
From source file:com.cognifide.aet.job.common.modifiers.cookie.CookieModifier.java
License:Apache License
private void addCookie(WebDriver webDriver) { webDriver.get(properties.getUrl());//from ww w . j a v a2 s . c o m Cookie cookie = new Cookie(name, value, domain, path, null); webDriver.manage().addCookie(cookie); webCommunicationWrapper.getHttpRequestBuilder().addCookie(name, value); }
From source file:com.cognifide.qa.bb.aem.AemAuthCookieFactory.java
License:Apache License
private Cookie findAuthenticationCookie(List<org.apache.http.cookie.Cookie> cookies) { for (org.apache.http.cookie.Cookie cookie : cookies) { if (properties.getProperty(ConfigKeys.LOGIN_TOKEN, DEFAULT_LOGIN_TOKEN).equals(cookie.getName())) { return new Cookie(cookie.getName(), cookie.getValue(), cookie.getDomain(), cookie.getPath(), cookie.getExpiryDate()); }/* www . j ava 2 s . c o m*/ } return null; }
From source file:com.cognifide.qa.bb.provider.selenium.webdriver.WebDriverType.java
License:Apache License
private static WebDriver getWebDriverWithProxyCookieSupport(Properties properties, WebDriver driver) { if (Boolean.valueOf(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE))) { driver.get(properties.getProperty(ConfigKeys.BASE_URL)); Cookie cookie = new Cookie(properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_NAME), properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_VALUE), "." + properties.getProperty(ConfigKeys.WEBDRIVER_PROXY_COOKIE_DOMAIN), "/", DateUtils.addMonths(new Date(), 1)); driver.manage().addCookie(cookie); }// w w w .jav a 2 s . c o m return driver; }
From source file:org.jspringbot.keyword.selenium.SeleniumHelper.java
License:Open Source License
public void addCookie(String cookieName, String cookieValue, String host, String domain, String path) { LOG.createAppender().appendBold("Add Cookie:").appendProperty("Cookie Name", cookieName) .appendProperty("Cookie Value", cookieValue).appendProperty("Host", host) .appendProperty("Domain", domain).appendProperty("Path", path).log(); driver.get(host);//w w w . jav a 2 s . c om Cookie cookie = new Cookie(cookieName, cookieValue, domain, path, null); driver.manage().addCookie(cookie); }
From source file:utils.WebDriverUtils.java
public static void addCookie(WebDriver webDriver, String name, String value, String domain, String path, Date expiry) {//w w w.ja v a 2s .c om Cookie cookie = new Cookie(name, value, domain, path, expiry); webDriver.manage().addCookie(cookie); }