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

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

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

Cookie.validate介绍

暂无

代码示例

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

public Cookie(String name, String value, String domain, String path, Date expiry) {
 this.name = name;
 this.value = value;
 this.path = path == null || "".equals(path) ? "/" : path;
 this.domain = domain;
 if (expiry != null) {
  //igonre the milliseconds because firefox only keeps the seconds
  this.expiry = new Date(expiry.getTime() / 1000 * 1000);
 } else {
  this.expiry = null;
 }
 validate();
}

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

public void addCookie(Cookie cookie) {
 cookie.validate();
 execute(DriverCommand.ADD_COOKIE, ImmutableMap.of("cookie", cookie));
}

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

public void addCookie(Cookie cookie) {
  cookie.validate();
  execute(DriverCommand.ADD_COOKIE, ImmutableMap.of("cookie", cookie));
}

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

public void addCookie(Cookie cookie) {
  cookie.validate();
  execute(DriverCommand.ADD_COOKIE, ImmutableMap.of("cookie", cookie));
 }

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

@Override
protected void validate() {
 super.validate();
 String domain = getDomain();
 if (domain != null && !"".equals(domain)) {
  try {
   String domainToUse = domain.startsWith("http") ? domain : "http://" + domain;
   URL url = new URL(domainToUse);
   InetAddress.getByName(url.getHost());
  } catch (MalformedURLException e) {
   throw new IllegalArgumentException(String.format("URL not valid: %s", domain));
  } catch (UnknownHostException e) {
   throw new IllegalArgumentException(String.format("Domain does not exist: %s", domain));
  }
 }
}

相关文章