Java Code Examples for org.openqa.selenium.remote.DesiredCapabilities.getCapability()

The following are Jave code examples for showing how to use getCapability() of the org.openqa.selenium.remote.DesiredCapabilities class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: devtools-driver   File: SafariBrowserLauncher.java   Source Code and License Vote up 6 votes
@Override
public final SafariBrowser launch(DesiredCapabilities caps) throws BrowserException {
  String udid = (String) caps.getCapability("uuid");
  SafariBrowser browser = udid == null ? launch() : launch(udid);
  @SuppressWarnings("unchecked")
  Map<String, String> proxyDict = (Map<String, String>) caps.getCapability("proxy");
  if (proxyDict != null) {
    HostAndPort proxy = HostAndPort.fromString(proxyDict.get("httpProxy"));
    browser.setHttpProxy(proxy);
  }
  @SuppressWarnings("unchecked")
  Map<String, String> cert = (Map<String, String>) caps.getCapability("httpsCert");
  if (cert != null) {
    browser.installHttpsCert(cert.get("certName"), cert.get("certContentBase64"));
  }
  return browser;
}
 
Example 2
Project: Cognizant-Intelligent-Test-Scripter   File: WebDriverFactory.java   Source Code and License Vote up 5 votes
/**
 * https://developers.google.com/web/updates/2017/04/headless-chrome
 *
 * @param caps
 * @return
 */
private static DesiredCapabilities withHeadlessChrome(DesiredCapabilities caps) {
    ChromeOptions options = (ChromeOptions) caps.getCapability(ChromeOptions.CAPABILITY);
    options.addArguments("--headless", "--disable-gpu", "--window-size=1366,768");
    caps.setCapability(ChromeOptions.CAPABILITY, options);
    return caps;
}