org.openqa.selenium.opera.OperaDriver Java Examples

The following examples show how to use org.openqa.selenium.opera.OperaDriver. 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: OperaDriverHandler.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);
        OperaOptions operaOptions = (OperaOptions) getOptions(parameter,
                testInstance);
        if (capabilities.isPresent()) {
            operaOptions.merge(capabilities.get());
        }

        object = new OperaDriver(operaOptions);
    } catch (Exception e) {
        handleException(e);
    }
}
 
Example #2
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 #3
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 #4
Source File: WebDriverTypeTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
private static void testGetOperaWebDriver(WebDriverConfiguration configuration, OperaOptions operaOptions)
        throws Exception
{
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    OperaDriver expected = mock(OperaDriver.class);
    whenNew(OperaDriver.class).withParameterTypes(OperaOptions.class).withArguments(operaOptions)
            .thenReturn(expected);
    WebDriver actual = WebDriverType.OPERA.getWebDriver(desiredCapabilities, configuration);
    assertEquals(expected, actual);
}
 
Example #5
Source File: OperaTest.java    From webdrivermanager with Apache License 2.0 5 votes vote down vote up
@Before
public void setupTest() {
    String operaBinary = IS_OS_WINDOWS
            ? "C:\\Users\\boni\\AppData\\Local\\Programs\\Opera\\launcher.exe"
            : IS_OS_MAC ? "/Applications/Opera.app/Contents/MacOS/Opera"
                    : "/usr/bin/opera";
    File opera = new File(operaBinary);
    assumeTrue(opera.exists());

    driver = new OperaDriver();
}
 
Example #6
Source File: OperaUser.java    From openvidu with Apache License 2.0 5 votes vote down vote up
public OperaUser(String userName, int timeOfWaitInSeconds) {
	super(userName, timeOfWaitInSeconds);

	OperaOptions options = new OperaOptions();
	options.setBinary("/usr/bin/opera");
	DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
	capabilities.setAcceptInsecureCerts(true);
	capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);

	options.addArguments("--use-fake-ui-for-media-stream");
	options.addArguments("--use-fake-device-for-media-stream");
	capabilities.setCapability(OperaOptions.CAPABILITY, options);

	String REMOTE_URL = System.getProperty("REMOTE_URL_OPERA");
	if (REMOTE_URL != null) {
		log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
		try {
			this.driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	} else {
		log.info("Using local web driver");
		this.driver = new OperaDriver(capabilities);
	}

	this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
	this.configureDriver();
}
 
Example #7
Source File: LocalWebDriverTest.java    From Mastering-Software-Testing-with-JUnit-5 with MIT License 5 votes vote down vote up
@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"));
}
 
Example #8
Source File: OperaAnnotationReaderTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@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"));
}
 
Example #9
Source File: OperaWithOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
public void operaTest(
        @Binary("/usr/bin/opera") @Arguments("private") OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #10
Source File: OperaExtensionJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
void operaExtensionTest(
        @Binary("/usr/bin/opera") @Extensions("atomizer.crx") OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #11
Source File: CreateRepositoryInGitHubStepDefinition.java    From base_project_for_web_automation_projects with MIT License 5 votes vote down vote up
private void verifyIfDriverIsOpera() {
    if(OPERA.equals(System.getProperty("context"))){
        OperaOptions operaOptions = new OperaOptions();
        operaOptions.setBinary(System.getProperty("binary"));
        BrowseTheWeb.as(theActorCalled(CESAR)).setDriver(new OperaDriver(operaOptions));
    }
}
 
Example #12
Source File: OperaJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void test(OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #13
Source File: OperaWithGlobalOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void operaTest(OperaDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example #14
Source File: OperaFactory.java    From webtester2-core with Apache License 2.0 4 votes vote down vote up
public OperaFactory() {
    super((capabilities) -> {
        OperaOptions operaOptions = new OperaOptions().merge(capabilities);
        return new OperaDriver(operaOptions);
    });
}
 
Example #15
Source File: ForcedOperaJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void operaTest(OperaDriver driver) {
    // Even if Opera is not installed, test should reach this point
    assertTrue(true);
}
 
Example #16
Source File: DefaultLocalDriverProvider.java    From webdriver-factory with Apache License 2.0 4 votes vote down vote up
public WebDriver createDriver(OperaOptions options) {
  return new OperaDriver(options);
}
 
Example #17
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 #18
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 #19
Source File: CustomDriverProvider.java    From akita with Apache License 2.0 2 votes vote down vote up
/**
 * Создает экземпляр OperaDriver с переданными capabilities и window dimensions
 *
 * @return WebDriver
 */
private WebDriver createOperaDriver(DesiredCapabilities capabilities) {
    OperaDriver operaDriver = new OperaDriver(getOperaDriverOptions(capabilities));
    return operaDriver;
}