org.openqa.selenium.edge.EdgeDriver Java Examples

The following examples show how to use org.openqa.selenium.edge.EdgeDriver. 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: DriverFactory.java    From java-maven-selenium with MIT License 6 votes vote down vote up
static WebDriver getDriver() {

        String browser = System.getenv("BROWSER");
        if (browser == null) {
            WebDriverManager.chromedriver().setup();
            return new ChromeDriver();
        }
        switch (browser)
        {
            case "IE":
                WebDriverManager.iedriver().setup();
                return new InternetExplorerDriver();
            case "EDGE":
                WebDriverManager.edgedriver().setup();
                return new EdgeDriver();
            case "FIREFOX":
                WebDriverManager.firefoxdriver().setup();
                return new FirefoxDriver();
            default:
                WebDriverManager.chromedriver().setup();
                return new ChromeDriver();

        }
    }
 
Example #2
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 #3
Source File: ForcedAnnotationReaderTest.java    From selenium-jupiter with Apache License 2.0 6 votes vote down vote up
static Stream<Arguments> forcedTestProvider() {
    return Stream.of(
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumNoCapabilitiesTest"),
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumWithCapabilitiesTest"),
            Arguments.of(ChromeDriverHandler.class,
                    ForcedBadChromeJupiterTest.class, ChromeDriver.class,
                    "chromeTest"),
            Arguments.of(FirefoxDriverHandler.class,
                    ForcedBadFirefoxJupiterTest.class, FirefoxDriver.class,
                    "firefoxTest"),
            Arguments.of(EdgeDriverHandler.class,
                    ForcedEdgeJupiterTest.class, EdgeDriver.class,
                    "edgeTest"),
            Arguments.of(OperaDriverHandler.class,
                    ForcedOperaJupiterTest.class, OperaDriver.class,
                    "operaTest"),
            Arguments.of(SafariDriverHandler.class,
                    ForcedSafariJupiterTest.class, SafariDriver.class,
                    "safariTest"));
}
 
Example #4
Source File: HTMLLauncher.java    From selenium with Apache License 2.0 5 votes vote down vote up
private WebDriver createDriver(String browser) {
  String[] parts = browser.split(" ", 2);
  browser = parts[0];
  switch (browser) {
    case "*chrome":
    case "*firefox":
    case "*firefoxproxy":
    case "*firefoxchrome":
    case "*pifirefox":
      FirefoxOptions options = new FirefoxOptions().setLegacy(false);
      if (parts.length > 1) {
        options.setBinary(parts[1]);
      }
      return new FirefoxDriver(options);

    case "*iehta":
    case "*iexplore":
    case "*iexploreproxy":
    case "*piiexplore":
      return new InternetExplorerDriver();

    case "*googlechrome":
      return new ChromeDriver();

    case "*MicrosoftEdge":
      return new EdgeDriver();

    case "*opera":
    case "*operablink":
      return new OperaDriver();

    case "*safari":
    case "*safariproxy":
      return new SafariDriver();

    default:
      throw new RuntimeException("Unrecognized browser: " + browser);
  }
}
 
Example #5
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 #6
Source File: EdgeFactory.java    From webtester-core with Apache License 2.0 5 votes vote down vote up
public EdgeFactory() {
    super(new Function<DesiredCapabilities, WebDriver>() {
        @Override
        public WebDriver apply(DesiredCapabilities capabilities) {
            return new EdgeDriver(capabilities);
        }
    });
}
 
Example #7
Source File: EdgeVersionTest.java    From webdrivermanager with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    browserManager = WebDriverManager.getInstance(EdgeDriver.class);
    os = WIN;
    specificVersions = new String[] { "75.0.139.20", "76.0.183.0",
            "77.0.237.0", "78.0.277.0", "79.0.313.0", "80.0.361.111",
            "81.0.409.0", "82.0.459.1" };
}
 
Example #8
Source File: DefaultLocalDriverProviderTest.java    From webdriver-factory with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.WINDOWS)
@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
void canInstantiateEdgeDriverWithEdgeOptions() {
  driver = provider.createDriver(new EdgeOptions());
  assertTrue(driver instanceof EdgeDriver);
}
 
Example #9
Source File: EdgeDevTest.java    From webdrivermanager-examples with Apache License 2.0 5 votes vote down vote up
@Before
public void setupTest() {
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setBinary(
            "C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe");
    EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
    driver = new EdgeDriver(edgeOptions);
}
 
Example #10
Source File: BrowserDetectionImpl.java    From IridiumApplicationTesting with MIT License 5 votes vote down vote up
@Override
public boolean isEdge(@NotNull final WebDriver webDriver) {
	checkNotNull(webDriver);

	final boolean isEdgeBrowser = webDriver instanceof EdgeDriver;
	final boolean isRemoteEdgeBrowser = webDriver instanceof RemoteWebDriver
		&& ((RemoteWebDriver) webDriver).getCapabilities()
		.getBrowserName()
		.equalsIgnoreCase(EDGE_BROWSER_NAME);

	return isEdgeBrowser || isRemoteEdgeBrowser;
}
 
Example #11
Source File: EdgeAnnotationReaderTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource("testClassProvider")
void testEdgeOptions(Class<?> testClass) throws Exception {
    Parameter parameter = testClass.getMethod("edgeTest", EdgeDriver.class)
            .getParameters()[0];
    Optional<Object> testInstance = Optional.of(testClass.newInstance());
    EdgeOptions edgeOptions = (EdgeOptions) annotationsReader
            .getOptions(parameter, testInstance);
    assertThat(edgeOptions.getCapability("pageLoadStrategy"),
            equalTo("eager"));
}
 
Example #12
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 #13
Source File: LocalBrowserFactory.java    From aquality-selenium-java with Apache License 2.0 5 votes vote down vote up
@Override
public Browser getBrowser() {
    BrowserName browserName = browserProfile.getBrowserName();
    RemoteWebDriver driver;
    IDriverSettings driverSettings = browserProfile.getDriverSettings();
    String webDriverVersion = driverSettings.getWebDriverVersion();
    Architecture systemArchitecture = driverSettings.getSystemArchitecture();
    switch (browserName) {
        case CHROME:
            WebDriverManager.chromedriver().version(webDriverVersion).setup();
            driver = getDriver(ChromeDriver.class, driverSettings.getCapabilities());
            break;
        case FIREFOX:
            WebDriverManager.firefoxdriver().version(webDriverVersion).setup();
            driver = getDriver(FirefoxDriver.class, driverSettings.getCapabilities());
            break;
        case IEXPLORER:
            WebDriverManager.iedriver().architecture(systemArchitecture).version(webDriverVersion).setup();
            driver = getDriver(InternetExplorerDriver.class, driverSettings.getCapabilities());
            break;
        case EDGE:
            WebDriverManager.edgedriver().version(webDriverVersion).setup();
            driver = getDriver(EdgeDriver.class, driverSettings.getCapabilities());
            break;
        case SAFARI:
            driver = getDriver(SafariDriver.class, driverSettings.getCapabilities());
            break;
        default:
            throw getLoggedWrongBrowserNameException();
    }
    logBrowserIsReady(browserName);

    return new Browser(driver);
}
 
Example #14
Source File: Free_ssCrawlerServiceImpl.java    From ShadowSocks-Share with Apache License 2.0 5 votes vote down vote up
@Override
public WebDriver getDriver() {
	System.setProperty("webdriver.edge.driver", driverPath);
	// System.setProperty("webdriver.ie.driver.loglevel", "DEBUG");

	org.openqa.selenium.edge.EdgeDriverService service = org.openqa.selenium.edge.EdgeDriverService.createDefaultService();

	EdgeOptions options = new EdgeOptions();
	return new EdgeDriver(service, options);
}
 
Example #15
Source File: EdgeTest.java    From webdrivermanager-examples with Apache License 2.0 4 votes vote down vote up
@Before
public void setupTest() {
    driver = new EdgeDriver();
}
 
Example #16
Source File: EdgeFactory.java    From webtester-core with Apache License 2.0 4 votes vote down vote up
public Browser createBrowser() {
    EdgeDriverService service = EdgeDriverService.createDefaultService();
    DesiredCapabilities capabilities = getDefaultCapabilities();
    return createBrowser(new EdgeDriver(service, capabilities));
}
 
Example #17
Source File: Browser.java    From coteafs-selenium with Apache License 2.0 4 votes vote down vote up
private static WebDriver setupEdgeDriver() throws MalformedURLException {
    LOG.i("Setting up Edge driver...");
    setupDriver(edgedriver());
    final EdgeOptions options = new EdgeOptions();
    return new EdgeDriver(options);
}
 
Example #18
Source File: EdgeTest.java    From webdrivermanager with Apache License 2.0 4 votes vote down vote up
@Before
public void setupTest() {
    driver = new EdgeDriver();
}
 
Example #19
Source File: LatestAndBetaTest.java    From webdrivermanager with Apache License 2.0 4 votes vote down vote up
@Parameters(name = "{index}: {0}")
public static Collection<Object[]> data() {
    return asList(new Object[][] { { ChromeDriver.class },
            { EdgeDriver.class } });
}
 
Example #20
Source File: ForceDownloadTest.java    From webdrivermanager with Apache License 2.0 4 votes vote down vote up
@Parameters(name = "{index}: {0}")
public static Collection<Object[]> data() {
    return asList(new Object[][] { { ChromeDriver.class },
            { FirefoxDriver.class }, { OperaDriver.class },
            { EdgeDriver.class } });
}
 
Example #21
Source File: DefaultLocalDriverProvider.java    From webdriver-factory with Apache License 2.0 4 votes vote down vote up
public WebDriver createDriver(EdgeOptions options) {
  return new EdgeDriver(options);
}
 
Example #22
Source File: EdgeSettingVersionJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
void webrtcTest(EdgeDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #23
Source File: EdgeFactory.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
public EdgeFactory() {
    super((capabilities) -> {
        EdgeOptions edgeOptions = new EdgeOptions().merge(capabilities);
        return new EdgeDriver(edgeOptions);
    });
}
 
Example #24
Source File: EdgeDriverCreator.java    From bobcat with Apache License 2.0 4 votes vote down vote up
@Override
public WebDriver create(Capabilities capabilities) {
  LOG.info("Starting the initialization of '{}' WebDriver instance", ID);
  LOG.debug("Initializing WebDriver with following capabilities: {}", capabilities);
  return new EdgeDriver(new EdgeOptions().merge(capabilities));
}
 
Example #25
Source File: StandaloneDriverFactory.java    From teasy with MIT License 4 votes vote down vote up
private WebDriver edge(DesiredCapabilities customCaps) {
    DriverHolder.setDriverName(EDGE);
    WebDriverManager.edgedriver().setup();
    return new EdgeDriver(
            new EdgeCaps(customCaps, this.alertBehaviour).get());
}
 
Example #26
Source File: SeleniumExtension.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
public SeleniumExtension() {
    addEntry(handlerMap, "org.openqa.selenium.chrome.ChromeDriver",
            ChromeDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.firefox.FirefoxDriver",
            FirefoxDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.edge.EdgeDriver",
            EdgeDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.opera.OperaDriver",
            OperaDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.safari.SafariDriver",
            SafariDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.remote.RemoteWebDriver",
            RemoteDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.WebDriver",
            RemoteDriverHandler.class);
    addEntry(handlerMap, "io.appium.java_client.AppiumDriver",
            AppiumDriverHandler.class);
    addEntry(handlerMap, "java.util.List", ListDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.phantomjs.PhantomJSDriver",
            OtherDriverHandler.class);
    addEntry(handlerMap, "org.openqa.selenium.ie.InternetExplorerDriver",
            InternetExplorerDriverHandler.class);
    addEntry(handlerMap, "com.codeborne.selenide.SelenideDriver",
            SelenideDriverHandler.class);

    addEntry(templateHandlerMap, "chrome", ChromeDriver.class);
    addEntry(templateHandlerMap, "firefox", FirefoxDriver.class);
    addEntry(templateHandlerMap, "edge", EdgeDriver.class);
    addEntry(templateHandlerMap, "opera", OperaDriver.class);
    addEntry(templateHandlerMap, "safari", SafariDriver.class);
    addEntry(templateHandlerMap, "appium", AppiumDriver.class);
    addEntry(templateHandlerMap, "phantomjs", PhantomJSDriver.class);
    addEntry(templateHandlerMap, "iexplorer", InternetExplorerDriver.class);
    addEntry(templateHandlerMap, "internet explorer",
            InternetExplorerDriver.class);
    addEntry(templateHandlerMap, "chrome-in-docker", RemoteWebDriver.class);
    addEntry(templateHandlerMap, "firefox-in-docker",
            RemoteWebDriver.class);
    addEntry(templateHandlerMap, "opera-in-docker", RemoteWebDriver.class);
    addEntry(templateHandlerMap, "edge-in-docker", RemoteWebDriver.class);
    addEntry(templateHandlerMap, "iexplorer-in-docker",
            RemoteWebDriver.class);
    addEntry(templateHandlerMap, "android", RemoteWebDriver.class);
    addEntry(templateHandlerMap, "selenide", SelenideDriverHandler.class);
}
 
Example #27
Source File: ForcedEdgeJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void edgeTest(EdgeDriver driver) {
    assumeFalse(IS_OS_WINDOWS);
    assertThat(driver, nullValue());
}
 
Example #28
Source File: EdgeWithGlobalOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void edgeTest(EdgeDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #29
Source File: EdgeJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
void edgeTest(EdgeDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #30
Source File: SearchTestWithEdge.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 3 votes vote down vote up
@BeforeMethod
public void setup() {

    System.setProperty("webdriver.edge.driver",
            "./src/test/resources/drivers/MicrosoftWebDriver.exe");

    EdgeOptions options = new EdgeOptions();
    options.setPageLoadStrategy("eager");

    driver = new EdgeDriver(options);

    driver.get("http://demo-store.seleniumacademy.com/");
}