Java 类org.openqa.selenium.opera.OperaDriver 实例源码

项目:selenium-cucumber-framework    文件:BrowserFactory.java   
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");
    }
}
项目: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    文件:OperaDriverHandler.java   
@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);
    }
}
项目:jwebrobot    文件:WebDriverProvider.java   
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();
    }
}
项目:webdrivermanager    文件:OperaTest.java   
@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);
}
项目:mastering-junit5    文件:LocalWebDriverTest.java   
@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"));
}
项目:selenium-jupiter    文件:OperaExtensionJupiterTest.java   
@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"));
}
项目:selenium-jupiter    文件:OperaWithOptionsJupiterTest.java   
@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"));
}
项目: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    文件:OperaAnnotationReaderTest.java   
@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"));
}
项目:Java-Testing-Toolbox    文件:OperaConfiguration.java   
/**
 * {@inheritDoc}
 */
@Override
public OperaDriver start(Capabilities other) {
    Capabilities capabilities = this.mergeCapabilities(other);

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

    return new OperaDriver(capabilities);
}
项目:Mastering-Software-Testing-with-JUnit-5    文件:LocalWebDriverTest.java   
@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"));
}
项目:componentrenderer    文件:AbstractTestBase.java   
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));
}
项目:givemeadriver    文件:OperaDriverFactory.java   
@Override
public WebDriver createDriver(Capabilities capabilities) {
    String driverVersion = (String) capabilities.getCapability(CAPABILITY_DRIVER_VERSION);
    OperaDriverManager.getInstance().version(driverVersion).setup();
    return  new OperaDriver((OperaOptions) capabilities);
}
项目:selenium-jupiter    文件:ForcedOperaJupiterTest.java   
@Test
public void operaTest(OperaDriver driver) {
    assertThat(driver, nullValue());
}
项目:selenium-jupiter    文件:OperaWithGlobalOptionsJupiterTest.java   
@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"));
}
项目:selenium-jupiter    文件:OperaJupiterTest.java   
@Test
public void test(OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("A JUnit 5 extension for Selenium WebDriver"));
}
项目:revature-automation-framework-remastered    文件:DriverHolder.java   
private static WebDriver getOperaDriverLinux32(){
    System.setProperty("webdriver.Opera.driver",dir+"Linux32Operadriver");
    WebDriver driver = new OperaDriver();
    return driver;
}
项目:revature-automation-framework-remastered    文件:DriverHolder.java   
private static WebDriver getOperaDriverWindows32(){
    System.setProperty("webdriver.Opera.driver",dir+"Windows32Operadriver.exe");
    WebDriver driver = new OperaDriver();
    return driver;
}
项目:revature-automation-framework-remastered    文件:DriverHolder.java   
private static WebDriver getOperaDriverLinux64(){
    System.setProperty("webdriver.Opera.driver",dir+"Linux64Operadriver");
    WebDriver driver = new OperaDriver();
    return driver;
}
项目:revature-automation-framework-remastered    文件:DriverHolder.java   
private static WebDriver getOperaDriverWindows64(){
    System.setProperty("webdriver.Opera.driver",dir+"Windows64Operadriver.exe");
    WebDriver driver = new OperaDriver();
    return driver;
}
项目:revature-automation-framework-remastered    文件:DriverHolder.java   
private static WebDriver getOperaDriverMac(){
    System.setProperty("webdriver.Opera.driver",dir+"MacOperadriver");
    WebDriver driver = new OperaDriver();
    return driver;
}
项目:frameworkium-core    文件:OperaImpl.java   
@Override
public WebDriver getWebDriver(Capabilities capabilities) {
    return new OperaDriver(capabilities);
}
项目:glue-selenese    文件:SeleneseMethodProvider.java   
private static WebDriver getOperaDriver(String language) {
    return new OperaDriver(getOperaCapabilities(language));
}
项目:Java-Testing-Toolbox    文件:SeleniumConfiguration.java   
/**
 * Get the default {@link OperaDriver} configuration.
 * 
 * @return The default {@link OperaDriver} configuration.
 */
public OperaConfiguration opera() {
    return (OperaConfiguration) this.getConfiguration().get(OperaDriver.class);
}
项目:Java-Testing-Toolbox    文件:SeleniumConfiguration.java   
/**
 * Set the default {@link InternetExplorerDriver} configuration.
 * 
 * @param configuration
 *            The {@link InternetExplorerDriver} configuration.
 * 
 * @return Itself.
 */
public SeleniumConfiguration opera(OperaConfiguration configuration) {
    return this.setDriverConfiguration(OperaDriver.class, configuration, new OperaConfiguration());
}