Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.DesiredCapabilities.merge()


      }

      capabilities.setCapability(option.getCapability(), option.getValue());
    }

    return capabilities.merge(surplusCapabilities);
  }

  /**
   * Converts this instance to its JSON representation.
   *
 
View Full Code Here


            "key2+=value2",
            "key3=value31", "key3+=value32",
            "key4+=value41", "key4+=value42")));
        DriverOptions driverOptions = new DriverOptions(cli);
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.merge(driverOptions.getCapabilities());
        assertThat((String) caps.getCapability("key1"), is(equalTo("value1")));
        assertThat((String[]) caps.getCapability("key2"), is(arrayContaining("value2")));
        assertThat((String[]) caps.getCapability("key3"), is(arrayContaining("value31", "value32")));
        assertThat((String[]) caps.getCapability("key4"), is(arrayContaining("value41", "value42")));
        assertThat(driverOptions.toString(), is(not("[]")));
View Full Code Here

            File binary = new File(driverOptions.get(PHANTOMJS));
            if (!binary.canExecute())
                throw new IllegalArgumentException("Missing PhantomJS binary: " + binary);
            caps.setCapability(PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary.getPath());
        }
        caps.merge(driverOptions.getCapabilities());
        if (driverOptions.has(CLI_ARGS)) {
            Object cliArgs = caps.getCapability(PHANTOMJS_CLI_ARGS);
            if (cliArgs == null) {
                cliArgs = ArrayUtils.EMPTY_STRING_ARRAY;
            } else {
View Full Code Here

        }
        InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
            .usingAnyFreePort()
            .withEnvironment(driverOptions.getEnvVars())
            .build();
        caps.merge(driverOptions.getCapabilities());
        InternetExplorerDriver driver = new InternetExplorerDriver(service, caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
    }
}
View Full Code Here

    }

    @Override
    public WebDriver newInstance(DriverOptions driverOptions) {
        DesiredCapabilities caps = setupProxy(DesiredCapabilities.safari(), driverOptions);
        caps.merge(driverOptions.getCapabilities());
        SafariDriver driver = new SafariDriver(caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
    }
}
View Full Code Here

        if (driverOptions.has(PROXY))
            options.addArguments("--proxy-server=http://" + driverOptions.get(PROXY));
        if (driverOptions.has(CLI_ARGS))
            options.addArguments(driverOptions.getCliArgs());
        caps.setCapability(ChromeOptions.CAPABILITY, options);
        caps.merge(driverOptions.getCapabilities());
        ChromeDriver driver = new ChromeDriver(service, caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
    }
}
View Full Code Here

                throw new IllegalArgumentException("Invalid --remote-url: " + e.getMessage());
            }
        } else {
            throw new IllegalArgumentException("Require --remote-url to know where to connect to");
        }
        caps.merge(driverOptions.getCapabilities());
        RemoteWebDriver driver = new AppiumDriver(url, caps);
        log.info("Session ID: " + driver.getSessionId());
        return driver;
    }
}
View Full Code Here

    @Override
    public WebDriver newInstance(DriverOptions driverOptions) {
        DesiredCapabilities caps = DesiredCapabilities.firefox();
        setupProxy(caps, driverOptions);
        caps.merge(driverOptions.getCapabilities());
        setDriverSpecificCapabilities(caps, driverOptions, false);
        FirefoxDriver driver = new FirefoxDriver(caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
    }
View Full Code Here

    @Override
    public WebDriver newInstance(DriverOptions driverOptions) {
        DesiredCapabilities caps = setupProxy(DesiredCapabilities.htmlUnit(), driverOptions);
        caps.setJavascriptEnabled(true);
        caps.merge(driverOptions.getCapabilities());
        HtmlUnitDriver driver = new HtmlUnitDriver(caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
    }
View Full Code Here

    @Override
    public WebDriver newInstance(DriverOptions driverOptions) {
        DesiredCapabilities caps = DesiredCapabilities.htmlUnit();
        setupProxy(caps, driverOptions);
        caps.merge(driverOptions.getCapabilities());
        if (driverOptions.has(REMOTE_BROWSER)) {
            String browser = driverOptions.get(REMOTE_BROWSER);
            caps.setBrowserName(browser);
            log.info("Remote browser: {}", browser);
            if ("firefox".equalsIgnoreCase(browser))
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.