Search in sources :

Example 21 with Proxy

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();
}
Also used : Proxy(org.openqa.selenium.Proxy) Test(org.junit.Test)

Example 22 with Proxy

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));
}
Also used : Proxy(org.openqa.selenium.Proxy) Test(org.junit.Test)

Example 23 with Proxy

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);
    }
}
Also used : Proxy(org.openqa.selenium.Proxy)

Example 24 with 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;
}
Also used : Proxy(org.openqa.selenium.Proxy) BrowserMobProxy(net.lightbody.bmp.BrowserMobProxy) InetSocketAddress(java.net.InetSocketAddress) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) BrowserMobProxyServer(net.lightbody.bmp.BrowserMobProxyServer)

Example 25 with Proxy

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);
        }
    };
}
Also used : Proxy(org.openqa.selenium.Proxy) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) InstanceFieldPerPropertyConfig(com.github.timurstrekalov.saga.core.cfg.InstanceFieldPerPropertyConfig) InstrumentingProxyServer(com.github.timurstrekalov.saga.core.server.InstrumentingProxyServer) File(java.io.File) BrowserVersion(com.gargoylesoftware.htmlunit.BrowserVersion) WebClient(com.gargoylesoftware.htmlunit.WebClient) FileServer(com.github.timurstrekalov.saga.core.FileServer) HtmlUnitDriver(org.openqa.selenium.htmlunit.HtmlUnitDriver) Before(org.junit.Before)

Aggregations

Proxy (org.openqa.selenium.Proxy)28 Test (org.junit.Test)11 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)6 BrowserMobProxy (net.lightbody.bmp.BrowserMobProxy)4 File (java.io.File)3 BrowserMobProxyServer (net.lightbody.bmp.BrowserMobProxyServer)3 ProxyHostPort (com.googlecode.jmeter.plugins.webdriver.proxy.ProxyHostPort)2 SystemProxy (com.qaprosoft.carina.proxy.SystemProxy)2 UnsupportedBrowserException (ru.sbtqa.tag.pagefactory.exceptions.UnsupportedBrowserException)2 TestSetup (com.coveros.selenified.utilities.TestSetup)1 BrowserVersion (com.gargoylesoftware.htmlunit.BrowserVersion)1 WebClient (com.gargoylesoftware.htmlunit.WebClient)1 Application (com.github.noraui.application.Application)1 FileServer (com.github.timurstrekalov.saga.core.FileServer)1 InstanceFieldPerPropertyConfig (com.github.timurstrekalov.saga.core.cfg.InstanceFieldPerPropertyConfig)1 InstrumentingProxyServer (com.github.timurstrekalov.saga.core.server.InstrumentingProxyServer)1 BrowserMobProxySupplier (com.hribol.automation.core.suppliers.BrowserMobProxySupplier)1 DesiredCapabilitiesSupplier (com.hribol.automation.core.suppliers.DesiredCapabilitiesSupplier)1 SeleniumProxySupplier (com.hribol.automation.core.suppliers.SeleniumProxySupplier)1 NetworkTrafficInterceptor (com.wikia.webdriver.common.core.networktrafficinterceptor.NetworkTrafficInterceptor)1