org.openqa.selenium.Cookie.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.openqa.selenium.Cookie.getName()方法的一些代码示例,展示了Cookie.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cookie.getName()方法的具体详情如下:
包路径:org.openqa.selenium.Cookie
类名称:Cookie
方法名:getName

Cookie.getName介绍

暂无

代码示例

代码示例来源:origin: selenide/selenide

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;
 }
}

代码示例来源:origin: cloudfoundry/uaa

System.out.println("cookie = " + String.format("%s=%s",cookie.getName(), cookie.getValue()));

代码示例来源:origin: cloudfoundry/uaa

System.out.println("cookie = " + String.format("%s=%s",cookie.getName(), cookie.getValue()));

代码示例来源:origin: com.machinepublishers/jbrowserdriver

/**
 * {@inheritDoc}
 */
@Override
public Cookie getCookieNamed(String name) {
 for (Cookie cookie : cookies) {
  if (cookie.getName().equals(name)) {
   return cookie;
  }
 }
 return null;
}

代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver

@Override
public Cookie getCookieNamed(String name) {
 Set<Cookie> allCookies = getCookies();
 for (Cookie cookie : allCookies) {
  if (name.equals(cookie.getName())) {
   return cookie;
  }
 }
 return null;
}

代码示例来源:origin: com.github.becauseQA/becauseQA-utils

public Cookie getCookieNamed(String name) {
 Set<Cookie> allCookies = getCookies();
 for (Cookie cookie : allCookies) {
  if (cookie.getName().equals(name)) {
   return cookie;
  }
 }
 return null;
}

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-remote-client

public Cookie getCookieNamed(String name) {
 Set<Cookie> allCookies = getCookies();
 for (Cookie cookie : allCookies) {
  if (cookie.getName().equals(name)) {
   return cookie;
  }
 }
 return null;
}

代码示例来源:origin: out0fmemory/GuozhongCrawler

public Cookie getCookieNamed(String name) {
  Set<Cookie> allCookies = getCookies();
  for (Cookie cookie : allCookies) {
   if (cookie.getName().equals(name)) {
    return cookie;
   }
  }
  return null;
 }

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-ie

public Cookie getCookieNamed(String name) {
 Set<Cookie> allCookies = getCookies();
 for (Cookie cookie : allCookies) {
  if (name.equals(cookie.getName())) {
   return cookie;
  }
 }
 return null;
}

代码示例来源:origin: com.github.becausetesting/commons

public Cookie getCookieNamed(String name) {
  Set<Cookie> allCookies = getCookies();
  for (Cookie cookie : allCookies) {
    if (cookie.getName().equals(name)) {
      return cookie;
    }
  }
  return null;
}

代码示例来源:origin: yandex-qatools/matchers-java

@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);
}

代码示例来源:origin: org.seleniumhq.webdriver/webdriver-ie

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());
 }
}

代码示例来源:origin: com.opera/operadriver

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);
}

代码示例来源:origin: com.opera/operadriver

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);
}

代码示例来源:origin: org.seleniumhq.selenium/selenium-android-driver

public void deleteCookie(Cookie cookie) {
 if (view == null) {
  throw new WebDriverException("No open windows.");
 }
 sessionCookieManager.remove(getCurrentUrl(), cookie.getName());
}

代码示例来源:origin: com.cognifide.aet/jobs

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");
}

代码示例来源:origin: org.jspringbot/jspringbot-selenium

public Set<Cookie> getCookies() {
  Set<Cookie> cookies = driver.manage().getCookies();
  for (Cookie cookie : cookies) {
    LOG.keywordAppender().appendArgument(cookie.getName(), cookie.getValue());
  }
  return cookies;
}

代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver

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()
 );
}

代码示例来源:origin: otto-de/jlineup

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));
}

代码示例来源:origin: org.openqa.selenium.webdriver/webdriver-htmlunit

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()));
}

相关文章