本文整理了Java中org.openqa.selenium.Proxy.<init>()
方法的一些代码示例,展示了Proxy.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.<init>()
方法的具体详情如下:
包路径:org.openqa.selenium.Proxy
类名称:Proxy
方法名:<init>
暂无
代码示例来源:origin: com.opera/operadriver
Proxy sanitize(Object proxy) {
if (proxy != null) {
if (proxy instanceof Proxy) {
return (Proxy) proxy;
} else if (proxy instanceof Map) {
return new Proxy((Map<String, ?>) proxy);
}
}
return null;
}
},
代码示例来源:origin: kg.apc/jmeter-plugins-webdriver
/**
* This will not use a proxy and expects a direct connection to the internet.
*
* @return a proxy object that does not use proxies.
*/
public Proxy getDirectProxy() {
return new Proxy()
.setProxyType(Proxy.ProxyType.DIRECT);
}
代码示例来源:origin: kg.apc/jmeter-plugins-webdriver
/**
* This will sttempt to use the system's proxy settings.
*
* @return a proxy object with the system's default proxy configured in it.
*/
public Proxy getSystemProxy() {
return new Proxy()
.setProxyType(Proxy.ProxyType.SYSTEM);
}
}
代码示例来源:origin: stackoverflow.com
String PROXY = "localhost:8080";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new InternetExplorerDriver(cap);
代码示例来源:origin: org.jspringbot/jspringbot-selenium
public void setFtpProxy(String proxyHost) {
if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) {
proxy = new Proxy();
proxy.setFtpProxy(proxyHost);
capabilities.setCapability(CapabilityType.PROXY, proxy);
}
}
代码示例来源:origin: stackoverflow.com
String PROXY = "localhost:8080";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new InternetExplorerDriver(cap);
代码示例来源:origin: org.jspringbot/jspringbot-selenium
public void setSslProxy(String proxyHost) {
if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) {
proxy = new Proxy();
proxy.setSslProxy(proxyHost);
capabilities.setCapability(CapabilityType.PROXY, proxy);
}
}
代码示例来源:origin: org.jspringbot/jspringbot-selenium
public void setHttpProxy(String proxyHost) {
if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) {
proxy = new Proxy();
proxy.setHttpProxy(proxyHost);
capabilities.setCapability(CapabilityType.PROXY, proxy);
}
}
代码示例来源:origin: kg.apc/jmeter-plugins-webdriver
/**
* This is a proxy which will have its settings automatically configured.
*
* @return a proxy object which will try to automatically detect the proxy settings.
*/
public Proxy getAutodetectProxy() {
return new Proxy()
.setProxyType(Proxy.ProxyType.AUTODETECT)
.setAutodetect(true);
}
代码示例来源: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.jspringbot/jspringbot-selenium
public void setProxy(String proxyHost) {
if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) {
proxy = new Proxy();
proxy.setFtpProxy(proxyHost)
.setHttpProxy(proxyHost)
.setSslProxy(proxyHost);
capabilities.setCapability(CapabilityType.PROXY, proxy);
}
}
代码示例来源:origin: groupon/odo
public org.openqa.selenium.Proxy seleniumProxy() throws UnknownHostException {
Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
String proxyStr = String.format("%s:%d", getLocalHost().getCanonicalHostName(), getPort());
proxy.setHttpProxy(proxyStr);
proxy.setSslProxy(proxyStr);
return proxy;
}
代码示例来源:origin: com.github.detro/browsermob-proxy-client
/**
* Returns the Proxy this client wraps, in form of a Selenium Proxy configuration object.
*
* @return Selenium Proxy configuration object
*/
public Proxy asSeleniumProxy() {
Proxy seleniumProxyConfig = new Proxy();
seleniumProxyConfig.setProxyType(Proxy.ProxyType.MANUAL);
seleniumProxyConfig.setHttpProxy(asHostAndPort());
return seleniumProxyConfig;
}
代码示例来源:origin: com.technophobia.substeps/webdriver-substeps
private void setNetworkCapabilities(final DesiredCapabilities capabilities) {
final String proxyHost = configuration.getNetworkProxyHost();
if (StringUtils.isNotEmpty(proxyHost)) {
final int proxyPort = configuration.getNetworkProxyPort();
final String proxyHostAndPort = proxyHost + ":" + proxyPort;
final org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(proxyHostAndPort).setFtpProxy(proxyHostAndPort).setSslProxy(proxyHostAndPort);
capabilities.setCapability(CapabilityType.PROXY, proxy);
LOG.info("Proxy set to {}", proxyHostAndPort);
}
}
代码示例来源:origin: paypal/SeLion
/**
* @return - A {@link Proxy} object that represents the Proxy server to be used.
*/
public static Proxy createProxyObject() {
Proxy proxy = new Proxy();
String proxyHost = String.format("%s:%s", getProperty(ConfigProperty.SELENIUM_PROXY_HOST),
getProperty(ConfigProperty.SELENIUM_PROXY_PORT));
proxy.setHttpProxy(proxyHost);
proxy.setFtpProxy(proxyHost);
proxy.setSslProxy(proxyHost);
return proxy;
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
/**
* @Title: browserProxySettings @Description: TODO @author
* alterhu2020@gmail.com @param @param capability @param @param
* proxysettings @return void return type @throws
*/
public static void ProxySettings(DesiredCapabilities capability, String proxysettings) {
org.openqa.selenium.Proxy httpproxy = new org.openqa.selenium.Proxy();
httpproxy.setHttpProxy(proxysettings);
httpproxy.setSslProxy(proxysettings);
httpproxy.setNoProxy("localhost");
capability.setCapability(CapabilityType.PROXY, httpproxy);
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: browserProxySettings @Description: TODO @author
* alterhu2020@gmail.com @param @param capability @param @param
* proxysettings @return void return type @throws
*/
public static void ProxySettings(DesiredCapabilities capability, String proxysettings) {
org.openqa.selenium.Proxy httpproxy = new org.openqa.selenium.Proxy();
httpproxy.setHttpProxy(proxysettings);
httpproxy.setSslProxy(proxysettings);
httpproxy.setNoProxy("localhost");
capability.setCapability(CapabilityType.PROXY, httpproxy);
}
代码示例来源:origin: com.axway.ats.framework/ats-uiengine
private void setFirefoxProxyIfAvailable(
DesiredCapabilities capabilities ) {
if (!StringUtils.isNullOrEmpty(AtsSystemProperties.SYSTEM_HTTP_PROXY_HOST)
&& !StringUtils.isNullOrEmpty(AtsSystemProperties.SYSTEM_HTTP_PROXY_PORT)) {
capabilities.setCapability(CapabilityType.PROXY,
new Proxy().setHttpProxy(AtsSystemProperties.SYSTEM_HTTP_PROXY_HOST
+ ':'
+ AtsSystemProperties.SYSTEM_HTTP_PROXY_PORT));
}
}
代码示例来源:origin: tarun3kumar/seleniumtestsframework
public Proxy getProxy() {
Proxy proxy = null;
if (proxyHost != null) {
proxy = new Proxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy(proxyHost);
proxy.setFtpProxy(proxyHost);
proxy.setSslProxy(proxyHost);
}
return proxy;
}
代码示例来源:origin: timurstrekalov/saga
private Capabilities getCapabilities() {
final String proxyUrl = "localhost:" + proxyServerPort;
final Proxy proxy = new Proxy()
.setProxyType(Proxy.ProxyType.MANUAL)
.setHttpProxy(proxyUrl)
.setSslProxy(proxyUrl);
final DesiredCapabilities desiredCapabilities = new DesiredCapabilities(config.getWebDriverCapabilities());
desiredCapabilities.setCapability(CapabilityType.PROXY, proxy);
desiredCapabilities.setJavascriptEnabled(true);
return desiredCapabilities;
}
内容来源于网络,如有侵权,请联系作者删除!