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

x33g5p2x  于2022-01-26 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(245)

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

Proxy.extractFrom介绍

暂无

代码示例

代码示例来源:origin: detro/ghostdriver

proxy = Proxy.extractFrom(desiredCapabilities);

代码示例来源:origin: net.serenity-bdd/serenity-core

public static Proxy extractProxy(Capabilities capabilities) {
    return Proxy.extractFrom(capabilities);
  }
}

代码示例来源:origin: vmi/selenese-runner-java

public static Proxy extractProxy(Capabilities desiredCapabilities) {
    return Proxy.extractFrom(desiredCapabilities);
  }
}

代码示例来源:origin: net.serenity-bdd/core

public static Proxy extractProxy(Capabilities capabilities) {
    return Proxy.extractFrom(capabilities);
  }
}

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

Settings build(Capabilities capabilities) {
  Map properties = new HashMap(capabilities.asMap());
  Proxy proxy = Proxy.extractFrom(capabilities);
  if (proxy != null) {
   String proxyConfigString = proxy.getHttpProxy();
   if (proxyConfigString != null) {
    Pattern pattern = Pattern.compile("(?:http(?:s)?:\\/\\/)?(?:([^:@]*):([^:@]*)@)?([^:@]*)(?::(\\d+))?");
    Matcher matcher = pattern.matcher(proxyConfigString);
    if (matcher.matches()) {
     properties.put(PropertyName.PROXY_TYPE.propertyName, ProxyConfig.Type.HTTP);
     properties.put(PropertyName.PROXY_USERNAME.propertyName, matcher.group(1));
     properties.put(PropertyName.PROXY_PASSWORD.propertyName, matcher.group(2));
     properties.put(PropertyName.PROXY_HOST.propertyName, matcher.group(3));
     properties.put(PropertyName.PROXY_PORT.propertyName, matcher.group(4));
    }
   }
  }
  for (Map.Entry entry : System.getProperties().entrySet()) {
   properties.put(entry.getKey(), entry.getValue());
  }
  return new Settings(this, properties);
 }
}

代码示例来源:origin: com.github.arachnidium/arachnidium-core

private void transformCapabilities() {
    // transforms relative path to application into absolute
    Object pathToApp = getCapability(appCapability);
    if (pathToApp != null) {
      File app = new File(String.valueOf(pathToApp));
      builtCapabilities.setCapability(appCapability,
          app.getAbsolutePath());
    }
    //sets proxy
    Proxy proxy = Proxy.extractFrom(builtCapabilities);
    if (proxy!=null){
      builtCapabilities.setCapability(proxyCapability, proxy);
    }
    // if other actions need to be implemented code will be below
  }
}

代码示例来源:origin: arachnidium/arachnidium-java

private void transformCapabilities() {
    // transforms relative path to application into absolute
    Object pathToApp = getCapability(appCapability);
    if (pathToApp != null) {
      File app = new File(String.valueOf(pathToApp));
      builtCapabilities.setCapability(appCapability,
          app.getAbsolutePath());
    }
    //sets proxy
    Proxy proxy = Proxy.extractFrom(builtCapabilities);
    if (proxy!=null){
      builtCapabilities.setCapability(proxyCapability, proxy);
    }
    // if other actions need to be implemented code will be below
  }
}

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

/**
  * Drops capabilities that we shouldn't send over the wire.
  *
  * Used for capabilities which aren't BeanToJson-convertable, and are only used by the local
  * launcher.
  */
 private static Capabilities dropCapabilities(Capabilities capabilities) {
  if (capabilities == null) {
   return new ImmutableCapabilities();
  }

  MutableCapabilities caps;

  if (isLegacy(capabilities)) {
   final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
   caps = new MutableCapabilities(
     Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
  } else {
   caps = new MutableCapabilities(capabilities);
  }

  // Ensure that the proxy is in a state fit to be sent to the extension
  Proxy proxy = Proxy.extractFrom(capabilities);
  if (proxy != null) {
   caps.setCapability(PROXY, proxy);
  }

  return caps;
 }
}

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

/**
 * Note: There are two configuration modes for the HtmlUnitDriver using this constructor.
 * <ol>
 *   <li>The first is where the browserName is "chrome", "firefox" or "internet explorer"
 *       and browserVersion denotes the desired version.</li>
 *   <li>The second one is where the browserName is "htmlunit" and the browserVersion
 *       denotes the required browser AND its version. In this mode the browserVersion could be
 *       "chrome" for Chrome, "firefox-38" for Firefox 38 or "internet explorer-11" for IE 11.</li>
 * </ol>
 * <p>The Remote WebDriver uses the second mode - the first mode is deprecated and should not be used.
 *
 * @param capabilities desired capabilities requested for the htmlunit driver session
 */
public HtmlUnitDriver(Capabilities capabilities) {
 this(determineBrowserVersion(capabilities));
 setJavascriptEnabled(capabilities.isJavascriptEnabled());
 setProxySettings(Proxy.extractFrom(capabilities));
}

代码示例来源:origin: com.codeborne/phantomjsdriver

proxy = Proxy.extractFrom(desiredCapabilities);

代码示例来源:origin: vmi/selenese-runner-java

proxy = Proxy.extractFrom(desiredCapabilities);

相关文章