当前位置: 首页>>代码示例>>Java>>正文


Java EdgeDriver类代码示例

本文整理汇总了Java中org.openqa.selenium.edge.EdgeDriver的典型用法代码示例。如果您正苦于以下问题:Java EdgeDriver类的具体用法?Java EdgeDriver怎么用?Java EdgeDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EdgeDriver类属于org.openqa.selenium.edge包,在下文中一共展示了EdgeDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldCreateLocalDriverInstance

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@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);
}
 
开发者ID:sskorol,项目名称:webdriver-supplier,代码行数:27,代码来源:CoreTests.java

示例2: SeleniumExtension

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
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);
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:23,代码来源:SeleniumExtension.java

示例3: resolve

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:17,代码来源:EdgeDriverHandler.java

示例4: start

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
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();
    }
}
 
开发者ID:chr-krenn,项目名称:chr-krenn-fhj-ws2016-sd14-pse,代码行数:19,代码来源:BaseUITest.java

示例5: initED

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
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;
}
 
开发者ID:ObjectiveTester,项目名称:wisard,代码行数:21,代码来源:BrowserDriver.java

示例6: getDriver

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
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));
    }
}
 
开发者ID:galenframework,项目名称:galen,代码行数:25,代码来源:SeleniumBrowserFactory.java

示例7: edge

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
private WebDriver edge(DesiredCapabilities customDesiredCapabilities) {
    EdgeDriverManager.getInstance().setup();
    DesiredCapabilities desiredCapabilities = getEdgeDesiredCapabilities();
    if (!customDesiredCapabilities.asMap().isEmpty()) {
        desiredCapabilities.merge(customDesiredCapabilities);
    }
    return new EdgeDriver(desiredCapabilities);
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:9,代码来源:SeleniumTestExecutionListener.java

示例8: forcedTestProvider

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
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"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:28,代码来源:ForcedAnnotationReaderTest.java

示例9: testEdgeOptions

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@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"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:12,代码来源:EdgeAnnotationReaderTest.java

示例10: start

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public EdgeDriver start(Capabilities other) {
    Capabilities capabilities = this.mergeCapabilities(other);

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

    return new EdgeDriver(capabilities);
}
 
开发者ID:QACore,项目名称:Java-Testing-Toolbox,代码行数:14,代码来源:EdgeConfiguration.java

示例11: loadDefaultConfiguration

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:QACore,项目名称:Java-Testing-Toolbox,代码行数:18,代码来源:SeleniumConfiguration.java

示例12: getDriver

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@Override
protected WebDriver getDriver() throws Exception
{
    System.setProperty(
            "webdriver.edge.driver",
            "C:/Program Files (x86)/Microsoft Web Driver/MicrosoftWebDriver.exe"
            );
    return new EdgeDriver();
}
 
开发者ID:hiroshitoda,项目名称:WebDriverBenchmark,代码行数:10,代码来源:EdgeDriverBenchmarkTest.java

示例13: EdgeFactory

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
public EdgeFactory() {
    super(new Function<DesiredCapabilities, WebDriver>() {
        @Override
        public WebDriver apply(DesiredCapabilities capabilities) {
            return new EdgeDriver(capabilities);
        }
    });
}
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:9,代码来源:EdgeFactory.java

示例14: createWebDriver

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@Override
public WebDriver createWebDriver(String sessionName)
{
    return new EdgeDriver(createOptions());
}
 
开发者ID:porscheinformatik,项目名称:selenium-components,代码行数:6,代码来源:EdgeWebDriverFactory.java

示例15: createDriver

import org.openqa.selenium.edge.EdgeDriver; //导入依赖的package包/类
@Override
public WebDriver createDriver(Capabilities capabilities) {
    String driverVersion = (String) capabilities.getCapability(CAPABILITY_DRIVER_VERSION);
    EdgeDriverManager.getInstance().version(driverVersion).setup();
    return new EdgeDriver((EdgeOptions) capabilities);
}
 
开发者ID:isgarlo,项目名称:givemeadriver,代码行数:7,代码来源:EdgeDriverFactory.java


注:本文中的org.openqa.selenium.edge.EdgeDriver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。