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


Java OperaDriver类代码示例

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


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

示例1: selectLocalBrowser

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
public static WebDriver selectLocalBrowser() {
	switch (browser) {
	case Chrome:
		return new ChromeDriver();
	case Firefox:
		return new FirefoxDriver();
	case IE:
		return new InternetExplorerDriver();
	case Opera:
		return new OperaDriver();
	case Safari:
		return new SafariDriver();
	default:
		throw new WebDriverException("No browser specified");
	}
}
 
开发者ID:Spence1115,项目名称:selenium-cucumber-framework,代码行数:17,代码来源:BrowserFactory.java

示例2: SeleniumExtension

import org.openqa.selenium.opera.OperaDriver; //导入依赖的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.opera.OperaDriver; //导入依赖的package包/类
@Override
public void resolve() {
    try {
        Optional<Object> testInstance = context.getTestInstance();
        Optional<Capabilities> capabilities = annotationsReader
                .getCapabilities(parameter, testInstance);
        OperaOptions operaOptions = (OperaOptions) getOptions(parameter,
                testInstance);
        if (capabilities.isPresent()) {
            operaOptions.merge(capabilities.get());
        }
        object = new OperaDriver(operaOptions);
    } catch (Exception e) {
        handleException(e);
    }
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:17,代码来源:OperaDriverHandler.java

示例4: createInstance

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
public WebDriver createInstance(Type type) {
    switch (type) {
        case CHROME:
            return new ChromeDriver();
        case CHROME_HEADLESS:
            ChromeOptions options = new ChromeOptions();
            options.addArguments("--headless", "--disable-gpu");
            ChromeDriver chromeDriver = new ChromeDriver(options);

            return chromeDriver;
        case OPERA:
            return new OperaDriver(getOperaCapabilities());
        case FIREFOX:
        default:
            return new FirefoxDriver();
    }
}
 
开发者ID:automate-website,项目名称:jwebrobot,代码行数:18,代码来源:WebDriverProvider.java

示例5: setupTest

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Before
public void setupTest() {
    File operaBinary = IS_OS_WINDOWS
            ? new File("C:\\Program Files\\Opera\\launcher.exe")
            : new File("/usr/bin/opera");
    assumeTrue(operaBinary.exists());

    OperaOptions options = new OperaOptions();
    options.setBinary(operaBinary);
    driver = new OperaDriver(options);
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:12,代码来源:OperaTest.java

示例6: testWithFirefoxAndOpera

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void testWithFirefoxAndOpera(FirefoxDriver firefox,
        OperaDriver opera) {
    firefox.get("http://www.seleniumhq.org/");
    opera.get("http://junit.org/junit5/");

    assertTrue(firefox.getTitle().startsWith("Selenium"));
    assertTrue(opera.getTitle().equals("JUnit 5"));
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:10,代码来源:LocalWebDriverTest.java

示例7: operaTest

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(OperaDriver driver) {
    assertThat(driver, nullValue());
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:5,代码来源:ForcedOperaJupiterTest.java

示例8: operaExtensionTest

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
void operaExtensionTest(
        @Binary("/usr/bin/opera") @Extensions("atomizer.crx") OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:8,代码来源:OperaExtensionJupiterTest.java

示例9: operaTest

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(
        @Binary("/usr/bin/opera") @Arguments("private") OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:8,代码来源:OperaWithOptionsJupiterTest.java

示例10: forcedTestProvider

import org.openqa.selenium.opera.OperaDriver; //导入依赖的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

示例11: testOperaOptions

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
void testOperaOptions() throws Exception {
    Parameter parameter = OperaWithOptionsJupiterTest.class
            .getMethod("operaTest", OperaDriver.class).getParameters()[0];
    OperaOptions operaOptions = (OperaOptions) annotationsReader
            .getOptions(parameter, empty());

    assertThat(operaOptions.asMap().get("operaOptions").toString(),
            containsString("binary"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:11,代码来源:OperaAnnotationReaderTest.java

示例12: start

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

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

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

示例13: setupOperaDriver

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
protected void setupOperaDriver() {
    DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();

    OperaOptions options = new OperaOptions();
    options.setBinary(new File("/usr/bin/opera"));
    capabilities.setCapability(OperaOptions.CAPABILITY, options);
    setDriver(new OperaDriver(capabilities));
    getDriver().manage().window().setSize(
            new Dimension(1366, 768));
}
 
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:11,代码来源:AbstractTestBase.java

示例14: createDriver

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

示例15: operaTest

import org.openqa.selenium.opera.OperaDriver; //导入依赖的package包/类
@Test
public void operaTest(OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:7,代码来源:OperaWithGlobalOptionsJupiterTest.java


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