Package org.openqa.selenium

Examples of org.openqa.selenium.Proxy


        setPort(listener.getPort());
    }

    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;
    }
View Full Code Here


        setPort(listener.getPort());
    }

    public org.openqa.selenium.Proxy seleniumProxy() throws UnknownHostException {
        Proxy proxy = new Proxy();
        proxy.setProxyType(Proxy.ProxyType.MANUAL);
        String proxyStr = String.format("%s:%d", InetAddress.getLocalHost().getCanonicalHostName(),  getPort());
        proxy.setHttpProxy(proxyStr);
        proxy.setSslProxy(proxyStr);

        return proxy;
    }
View Full Code Here

  public WebDriver getDriver() {
    try {
      Report.action("Opening Firefox");
      DesiredCapabilities capabilities = DesiredCapabilities.firefox();
      if(StringUtils.isNotEmpty(Config.proxy_url)) {
        Proxy proxy = new Proxy();
        proxy.setProxyAutoconfigUrl("http://youdomain/config");
        capabilities.setCapability(CapabilityType.PROXY, proxy);
        Report.action("With proxy '" + Config.proxy_url + "'");
      }
      WebDriver driver = new FirefoxDriver(capabilities);
      return driver;
View Full Code Here

     * @param noProxy is a comma separated list of hosts that will bypass the proxy
     *
     * @returns a proxy object with the hosts manually specified.
     */
    public Proxy getManualProxy(ProxyHostPort httpProxy, ProxyHostPort httpsProxy, ProxyHostPort ftpProxy, ProxyHostPort socksProxy, String noProxy) {
        return new Proxy()
            .setProxyType(Proxy.ProxyType.MANUAL)
            .setHttpProxy(httpProxy.toUnifiedForm())
            .setSslProxy(httpsProxy.toUnifiedForm())
            .setFtpProxy(ftpProxy.toUnifiedForm())
            .setSocksProxy(socksProxy.toUnifiedForm())
View Full Code Here

     * This will not use a proxy and expects a direct connection to the internet.
     *
     * @returns a proxy object that does not use proxies.
     */
    public Proxy getDirectProxy() {
        return new Proxy()
            .setProxyType(Proxy.ProxyType.DIRECT);
    }
View Full Code Here

     * This is a proxy which will have its settings automatically configured.
     *
     * @returns a proxy object which will try to automatically detect the proxy settings.
     */
    public Proxy getAutodetectProxy() {
        return new Proxy()
            .setProxyType(Proxy.ProxyType.AUTODETECT)
            .setAutodetect(true);
    }
View Full Code Here

     * @param pacUrl is the url to the Proxy PAC file
     *
     * @returns 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);
    }
View Full Code Here

     * 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);
    }
View Full Code Here

        factory = ProxyFactory.getInstance();
    }

    @Test
    public void shouldCreateAnAutoDetectProxy() {
        Proxy proxy = factory.getAutodetectProxy();

        assertThat(proxy.getProxyType(), is(Proxy.ProxyType.AUTODETECT));
        assertThat(proxy.isAutodetect(), is(true));
    }
View Full Code Here

        assertThat(proxy.isAutodetect(), is(true));
    }

    @Test
    public void shouldCreateDirectProxy() {
        Proxy proxy = factory.getDirectProxy();

        assertThat(proxy.getProxyType(), is(Proxy.ProxyType.DIRECT));
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Proxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.