Java 类org.openqa.selenium.edge.EdgeDriver 实例源码

项目:webdriver-supplier    文件:CoreTests.java   
@Test
public void shouldCreateLocalDriverInstance() {
    Browser edge = StreamEx.of(browsers)
                             .findFirst(f -> f.name() == Browser.Name.Edge)
                             .orElseThrow(() -> new AssertionError(
                                     "Unable to get Edge implementation"));

    XmlConfig config = new XmlConfig(new HashMap<String, String>() {
        {
            put(BROWSER_NAME, "edge");
        }
    });

    PowerMockito.mockStatic(WebDriverManager.class);
    BrowserManager browserManager = mock(BrowserManager.class, RETURNS_DEEP_STUBS);
    WebDriver driver = mock(EdgeDriver.class, RETURNS_DEEP_STUBS);
    WebDriverProvider spyFactory = spy(defaultFactory);
    Reflect spyReflectedDriver = spy(spyFactory.wrapDriver(edge));

    PowerMockito.when(WebDriverManager.getInstance(spyReflectedDriver.type())).thenReturn(browserManager);
    doNothing().when(browserManager).setup();
    doReturn(spyReflectedDriver).when(spyFactory).wrapDriver(edge);
    doReturn(on(driver)).when(spyReflectedDriver).create(edge.configuration(config));

    assertThat(spyFactory.createDriver(edge, config)).isInstanceOf(EdgeDriver.class);
}
项目:selenium-jupiter    文件:SeleniumExtension.java   
public SeleniumExtension() {
    handlerMap.put(ChromeDriver.class, ChromeDriverHandler.class);
    handlerMap.put(FirefoxDriver.class, FirefoxDriverHandler.class);
    handlerMap.put(EdgeDriver.class, EdgeDriverHandler.class);
    handlerMap.put(OperaDriver.class, OperaDriverHandler.class);
    handlerMap.put(SafariDriver.class, SafariDriverHandler.class);
    handlerMap.put(RemoteWebDriver.class, RemoteDriverHandler.class);
    handlerMap.put(AppiumDriver.class, AppiumDriverHandler.class);
    handlerMap.put(List.class, ListDriverHandler.class);
    handlerMap.put(PhantomJSDriver.class, OtherDriverHandler.class);

    templateHandlerMap.put("chrome", ChromeDriver.class);
    templateHandlerMap.put("firefox", FirefoxDriver.class);
    templateHandlerMap.put("edge", EdgeDriver.class);
    templateHandlerMap.put("opera", OperaDriver.class);
    templateHandlerMap.put("safari", SafariDriver.class);
    templateHandlerMap.put("appium", AppiumDriver.class);
    templateHandlerMap.put("phantomjs", PhantomJSDriver.class);
    templateHandlerMap.put("chrome-in-docker", RemoteWebDriver.class);
    templateHandlerMap.put("firefox-in-docker", RemoteWebDriver.class);
    templateHandlerMap.put("opera-in-docker", RemoteWebDriver.class);
}
项目:selenium-jupiter    文件:EdgeDriverHandler.java   
@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);
    }
}
项目:chr-krenn-fhj-ws2016-sd14-pse    文件:BaseUITest.java   
WebDriver start(Capabilities capabilities) {
    switch (this) {
        case FIREFOX:
            return new FirefoxDriver(capabilities);
        case HTML_UNIT:
            return new HtmlUnitDriver(capabilities);
        case CHROME:
            return new ChromeDriver(capabilities);
        case EDGE:
            return new EdgeDriver(capabilities);
        case INTERNET_EXPLORER:
            return new InternetExplorerDriver(capabilities);
        case SAFARI:
            return new SafariDriver(capabilities);
        default:
            throw new AssertionError();
    }
}
项目:wisard    文件:BrowserDriver.java   
boolean initED(String url, String path) {
    //Edge
    try {
        System.setProperty("webdriver.edge.driver", path);
        driver = new EdgeDriver();
        js = (JavascriptExecutor) driver;
        writer.writeHeader(url, "ED");
        driver.get(url);
    } catch (IllegalStateException ise) {
        ui.errorMessage("Path to Edge driver is invalid, check settings.");
        return false;
    } catch (InvalidArgumentException iae) {
        ui.errorMessage("Invalid URL?");
        return false;
    } catch (Exception e) {
        System.err.println(e);
        return false;
    }
    return true;
}
项目:galen    文件:SeleniumBrowserFactory.java   
public static WebDriver getDriver(String browserType){

    if ( StringUtils.isEmpty(browserType) || FIREFOX.equals(browserType)) {
        return new FirefoxDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType));
    }
    else if (CHROME.equals(browserType)) {
        return new ChromeDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType));
    }
    else if (IE.equals(browserType)) {
        return new InternetExplorerDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType));
    }
    else if (PHANTOMJS.equals(browserType)) {
        return new PhantomJSDriver();
    }
    else if (SAFARI.equals(browserType)) {
        return new SafariDriver();
    }
    else if (EDGE.equals(browserType)) {
        return new EdgeDriver();
    }
    else {
        throw new RuntimeException(String.format("Unknown browser type: \"%s\"", browserType));
    }
}
项目:teasy    文件:SeleniumTestExecutionListener.java   
private WebDriver edge(DesiredCapabilities customDesiredCapabilities) {
    EdgeDriverManager.getInstance().setup();
    DesiredCapabilities desiredCapabilities = getEdgeDesiredCapabilities();
    if (!customDesiredCapabilities.asMap().isEmpty()) {
        desiredCapabilities.merge(customDesiredCapabilities);
    }
    return new EdgeDriver(desiredCapabilities);
}
项目:selenium-jupiter    文件:ForcedAnnotationReaderTest.java   
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(RemoteDriverHandler.class,
                    ForcedBadRemoteJupiterTest.class, RemoteWebDriver.class,
                    "remoteTest"),
            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"));
}
项目:selenium-jupiter    文件:EdgeAnnotationReaderTest.java   
@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"));
}
项目:Java-Testing-Toolbox    文件:EdgeConfiguration.java   
/**
 * {@inheritDoc}
 */
@Override
public EdgeDriver start(Capabilities other) {
    Capabilities capabilities = this.mergeCapabilities(other);

    if (capabilities == null) {
        return new EdgeDriver();
    }

    return new EdgeDriver(capabilities);
}
项目:Java-Testing-Toolbox    文件:SeleniumConfiguration.java   
/**
 * Load the default configuration. It will not erase previous non-default configurations.
 * 
 * @return Itself.
 */
public SeleniumConfiguration loadDefaultConfiguration() {
    this.getConfiguration().put(ChromeDriver.class, new ChromeConfiguration());
    this.getConfiguration().put(EdgeDriver.class, new EdgeConfiguration());
    this.getConfiguration().put(FirefoxDriver.class, new FirefoxConfiguration());
    this.getConfiguration().put(HtmlUnitConfiguration.class, new HtmlUnitConfiguration());
    this.getConfiguration().put(InternetExplorerConfiguration.class, new InternetExplorerConfiguration());
    this.getConfiguration().put(OperaConfiguration.class, new OperaConfiguration());
    this.getConfiguration().put(PhantomJSConfiguration.class, new PhantomJSConfiguration());
    this.getConfiguration().put(SafariDriver.class, new SafariConfiguration());

    return this;
}
项目:WebDriverBenchmark    文件:EdgeDriverBenchmarkTest.java   
@Override
protected WebDriver getDriver() throws Exception
{
    System.setProperty(
            "webdriver.edge.driver",
            "C:/Program Files (x86)/Microsoft Web Driver/MicrosoftWebDriver.exe"
            );
    return new EdgeDriver();
}
项目:webtester-core    文件:EdgeFactory.java   
public EdgeFactory() {
    super(new Function<DesiredCapabilities, WebDriver>() {
        @Override
        public WebDriver apply(DesiredCapabilities capabilities) {
            return new EdgeDriver(capabilities);
        }
    });
}
项目:selenium-components    文件:EdgeWebDriverFactory.java   
@Override
public WebDriver createWebDriver(String sessionName)
{
    return new EdgeDriver(createOptions());
}
项目:givemeadriver    文件:EdgeDriverFactory.java   
@Override
public WebDriver createDriver(Capabilities capabilities) {
    String driverVersion = (String) capabilities.getCapability(CAPABILITY_DRIVER_VERSION);
    EdgeDriverManager.getInstance().version(driverVersion).setup();
    return new EdgeDriver((EdgeOptions) capabilities);
}
项目:selenium-jupiter    文件:ForcedEdgeJupiterTest.java   
@Test
public void edgeTest(EdgeDriver driver) {
    assumeFalse(IS_OS_WINDOWS);
    assertThat(driver, nullValue());
}
项目:selenium-jupiter    文件:EdgeWithGlobalOptionsJupiterTest.java   
@Test
public void edgeTest(EdgeDriver driver) {
    driver.get("http://www.seleniumhq.org/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
项目:selenium-jupiter    文件:EdgeSettingVersionJupiterTest.java   
@Test
void webrtcTest(EdgeDriver driver) {
    driver.get("http://www.seleniumhq.org/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
项目:selenium-jupiter    文件:EdgeJupiterTest.java   
@Test
void edgeTest(EdgeDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
项目:webtester2-core    文件:EdgeFactory.java   
public EdgeFactory() {
    super(EdgeDriver::new);
}
项目:webdrivermanager-examples    文件:EdgeTest.java   
@Before
public void setupTest() {
    driver = new EdgeDriver();
}
项目:webdrivermanager    文件:EdgeTest.java   
@Before
public void setupTest() {
    driver = new EdgeDriver();
}
项目:webdrivermanager    文件:EdgeVersionTest.java   
@Before
public void setup() {
    browserManager = WebDriverManager.getInstance(EdgeDriver.class);
    os = WIN;
    specificVersions = new String[] { "3.14393", "4.15063" };
}
项目:alex    文件:EdgeDriverConfig.java   
@Override
public WebDriver createDriver() throws Exception {
    final WebDriver driver = new EdgeDriver();
    manage(driver);
    return driver;
}
项目:webtester-core    文件:EdgeFactory.java   
public Browser createBrowser() {
    EdgeDriverService service = EdgeDriverService.createDefaultService();
    DesiredCapabilities capabilities = getDefaultCapabilities();
    return createBrowser(new EdgeDriver(service, capabilities));
}
项目:Java-Testing-Toolbox    文件:SeleniumConfiguration.java   
/**
 * Get the default {@link EdgeDriver} configuration.
 * 
 * @return The default {@link EdgeDriver} configuration.
 */
public EdgeConfiguration edge() {
    return (EdgeConfiguration) this.getConfiguration().get(EdgeDriver.class);
}
项目:Java-Testing-Toolbox    文件:SeleniumConfiguration.java   
/**
 * Set the default {@link EdgeDriver} configuration.
 * 
 * @param configuration
 *            The {@link EdgeDriver} configuration.
 * 
 * @return Itself.
 */
public SeleniumConfiguration edge(EdgeConfiguration configuration) {
    return this.setDriverConfiguration(EdgeDriver.class, configuration, new EdgeConfiguration());
}