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

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

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

Proxy.setProxyAutoconfigUrl介绍

[英]Specifies the URL to be used for proxy auto-configuration. Expected format is http://hostname.com:1234/pacfile. This is required if #getProxyType() is set to ProxyType#PAC, ignored otherwise.
[中]指定用于代理自动配置的URL。预期格式为http://hostname.com:1234/pacfile。如果#getProxyType()设置为ProxyType#PAC,则需要此选项,否则将被忽略。

代码示例

代码示例来源:origin: kg.apc/jmeter-plugins-webdriver

/**
 * If the proxy can be configured using a PAC file at a URL, set this value to the location of this PAC file.
 *
 * @param pacUrl is the url to the Proxy PAC file
 *
 * @return a proxy object with its proxies configured automatically using a PAC file.
 */
public Proxy getConfigUrlProxy(String pacUrl) {
  return new Proxy()
    .setProxyType(Proxy.ProxyType.PAC)
    .setProxyAutoconfigUrl(pacUrl);
}

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

setProxyAutoconfigUrl((String) raw.get("proxyAutoconfigUrl"));

代码示例来源:origin: org.paxml/PaxmlSelenium

proxy.setProxyAutoconfigUrl(proxyAutoConfigUrl);

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

proxy.setProxyAutoconfigUrl(proxyAutoConfigUrl);

代码示例来源:origin: com.infotel.seleniumRobot/core

public Proxy getProxy() {
  ProxyConfig proxyConfig = getProxyConfig();
  
  Proxy proxy = new Proxy();
  proxy.setProxyType(proxyConfig.getType());
  
  if (proxyConfig.getType() == ProxyType.PAC) {
    proxy.setProxyAutoconfigUrl(proxyConfig.getPac());
    
  // manual proxy configuration
  } else if (proxyConfig.getType() == ProxyType.MANUAL) {
    proxy.setHttpProxy(proxyConfig.getAddressAndPort());
    proxy.setSslProxy(proxyConfig.getAddressAndPort());
    proxy.setFtpProxy(proxyConfig.getAddressAndPort());
    
    if (proxyConfig.getLogin() != null && proxyConfig.getPassword() != null) {
      proxy.setSocksUsername(proxyConfig.getLogin());
      proxy.setSocksPassword(proxyConfig.getPassword());
    }
    
    if (proxyConfig.getExclude() != null) {
      proxy.setNoProxy(proxyConfig.getExclude().replace(";", ","));
    }
  }     
  
  return proxy;
}

相关文章