Java Code Examples for org.openqa.selenium.edge.EdgeOptions#merge()

The following examples show how to use org.openqa.selenium.edge.EdgeOptions#merge() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EdgeDriverHandler.java    From selenium-jupiter with Apache License 2.0 6 votes vote down vote up
@Override
public void resolve() {
    try {
        Optional<Object> testInstance = context.getTestInstance();
        Optional<Capabilities> capabilities = annotationsReader
                .getCapabilities(parameter, testInstance);
        EdgeOptions edgeOptions = (EdgeOptions) getOptions(parameter,
                testInstance);
        if (capabilities.isPresent()) {
            edgeOptions.merge(capabilities.get());
        }
        object = new EdgeDriver(edgeOptions);
    } catch (Exception e) {
        handleException(e);
    }
}
 
Example 2
Source File: TestEdgeDriver.java    From selenium with Apache License 2.0 6 votes vote down vote up
private static Capabilities edgeWithCustomCapabilities(Capabilities originalCapabilities) {
  EdgeOptions options = new EdgeOptions();

  options.addArguments("disable-extensions", "disable-infobars", "disable-breakpad");
  Map<String, Object> prefs = new HashMap<>();
  prefs.put("exit_type", "None");
  prefs.put("exited_cleanly", true);
  options.setExperimentalOption("prefs", prefs);
  String edgePath = System.getProperty("webdriver.edge.binary");
  if (edgePath != null) {
    options.setBinary(new File(edgePath));
  }

  if (originalCapabilities != null) {
    options.merge(originalCapabilities);
  }

  return options;
}
 
Example 3
Source File: WebDriverTypeTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Test
@PrepareForTest(fullyQualifiedNames = "org.vividus.selenium.WebDriverType$5")
public void testGetEdgeWebDriver() throws Exception
{
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    EdgeOptions edgeOptions = new EdgeOptions();
    edgeOptions.merge(desiredCapabilities);
    edgeOptions.setCapability("ms:inPrivate", true);
    EdgeDriver expected = mock(EdgeDriver.class);
    whenNew(EdgeDriver.class).withParameterTypes(EdgeOptions.class).withArguments(edgeOptions).thenReturn(expected);
    WebDriver actual = WebDriverType.EDGE.getWebDriver(desiredCapabilities, new WebDriverConfiguration());
    assertEquals(expected, actual);
}
 
Example 4
Source File: WebDriverTypeTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@Test
@PrepareForTest(fullyQualifiedNames = "org.vividus.selenium.WebDriverType$7")
public void testGetEdgeChromiumWebDriver() throws Exception
{
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    EdgeOptions edgeOptions = new EdgeOptions();
    edgeOptions.merge(desiredCapabilities);
    EdgeDriver expected = mock(EdgeDriver.class);
    whenNew(EdgeDriver.class).withParameterTypes(EdgeOptions.class).withArguments(edgeOptions).thenReturn(expected);
    WebDriver actual = WebDriverType.EDGE_CHROMIUM.getWebDriver(desiredCapabilities, new WebDriverConfiguration());
    assertEquals(expected, actual);
}
 
Example 5
Source File: EdgeCaps.java    From teasy with MIT License 5 votes vote down vote up
public EdgeOptions get() {
    EdgeOptions caps = getEdgeOptions();
    if (!this.customCaps.asMap().isEmpty()) {
        caps.merge(this.customCaps);
    }
    return caps;
}
 
Example 6
Source File: CustomDriverProvider.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 * Задает options для запуска Edge драйвера
 * options можно передавать, как системную переменную, например -Doptions=--load-extension=my-custom-extension
 *
 * @return edgeOptions
 */
private EdgeOptions getEdgeDriverOptions(DesiredCapabilities capabilities) {
    log.info("---------------Edge Driver---------------------");
    EdgeOptions edgeOptions = new EdgeOptions();
    edgeOptions.setCapability(CapabilityType.BROWSER_VERSION, loadSystemPropertyOrDefault(CapabilityType.BROWSER_VERSION, VERSION_LATEST));
    edgeOptions.merge(capabilities);
    return edgeOptions;
}