use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.
the class WebDriverConfigTest method shouldDelegateToProxyFactoryWhenCreatingDirectProxy.
@Test
public void shouldDelegateToProxyFactoryWhenCreatingDirectProxy() {
when(proxyFactory.getDirectProxy()).thenReturn(new Proxy());
config.setProxyType(ProxyType.DIRECT);
Proxy proxy = config.createProxy();
assertThat(proxy, is(notNullValue()));
verify(proxyFactory, times(1)).getDirectProxy();
}
use of org.openqa.selenium.Proxy in project jmeter-plugins by undera.
the class ProxyFactoryTest method shouldCreateSystemProxy.
@Test
public void shouldCreateSystemProxy() {
Proxy proxy = factory.getSystemProxy();
assertThat(proxy.getProxyType(), is(Proxy.ProxyType.SYSTEM));
}
use of org.openqa.selenium.Proxy in project selenified by Coveros.
the class TestSetup method setupProxy.
/**
* Obtains the set system values for the proxy, and adds them to the desired
* capabilities
*/
public void setupProxy() {
// are we running through a proxy
if (System.getProperty(PROXY_INPUT) != null) {
// set the proxy information
Proxy proxy = new Proxy();
proxy.setHttpProxy(System.getProperty(PROXY_INPUT));
capabilities.setCapability(CapabilityType.PROXY, proxy);
}
}
use of org.openqa.selenium.Proxy in project java.webdriver by sayems.
the class BrowserThreads method getDriver.
private WebDriver getDriver(boolean useBrowserMobProxy) {
if (null != webdriver && usingBrowserMobProxy != useBrowserMobProxy) {
webdriver.quit();
webdriver = null;
}
if (null == webdriver) {
Proxy proxy = null;
if (proxyEnabled || useBrowserMobProxy) {
if (useBrowserMobProxy) {
usingBrowserMobProxy = true;
browserMobProxy = new BrowserMobProxyServer();
browserMobProxy.start();
if (proxyEnabled) {
browserMobProxy.setChainedProxy(new InetSocketAddress(proxyHostname, proxyPort));
}
proxy = ClientUtil.createSeleniumProxy(browserMobProxy);
} else {
proxy = new Proxy();
proxy.setProxyType(MANUAL);
proxy.setHttpProxy(proxyDetails);
proxy.setSslProxy(proxyDetails);
}
}
determineEffectiveDriverType();
DesiredCapabilities desiredCapabilities = selectedDriverType.browser.getDesiredCapabilities(proxy);
instantiateWebDriver(desiredCapabilities);
}
return webdriver;
}
use of org.openqa.selenium.Proxy in project saga by timurstrekalov.
the class InstrumentingProxyServerIT method setUp.
@Before
public void setUp() throws Exception {
final InstanceFieldPerPropertyConfig config = new InstanceFieldPerPropertyConfig();
proxyServer = new InstrumentingProxyServer(new HtmlUnitBasedScriptInstrumenter(config));
fileServer = new FileServer(new File(getClass().getResource("/tests").toURI()).getAbsolutePath());
proxyServerPort = proxyServer.start();
fileServerPort = fileServer.start();
final String proxyUrl = "localhost:" + proxyServerPort;
final Proxy proxy = new Proxy().setProxyType(Proxy.ProxyType.MANUAL).setHttpProxy(proxyUrl).setSslProxy(proxyUrl);
final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.PROXY, proxy);
desiredCapabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, true);
desiredCapabilities.setBrowserName(BrowserType.FIREFOX);
driver = new HtmlUnitDriver(desiredCapabilities) {
@Override
protected WebClient newWebClient(final BrowserVersion version) {
config.setBrowserVersion(version);
return WebClientFactory.newInstance(config);
}
};
}
Aggregations