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

项目:givemeadriver    文件:OperaCapabilitiesConverterTest.java   
@Test
public void settingBrowserSize() {
    // given
    WebDriverProperties properties = new WebDriverProperties();
    properties.setProperty("browserSize", "1690x1000");

    // when
    Capabilities convertedCapabilities = operaCapabilitiesConverter.convert(properties);

    // then
    // expected safari options
    OperaOptions expectedOperaOptions = new OperaOptions();
    expectedOperaOptions.setCapability(CAPABILITY_AUTOCLOSE, false);
    expectedOperaOptions.setCapability(CAPABILITY_BROWSER_SIZE, "1690x1000");

    assertThat(convertedCapabilities.asMap()).isEqualTo(expectedOperaOptions.asMap());

}
项目: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);
    }
}
项目: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);
}
项目:givemeadriver    文件:OperaCapabilitiesConverter.java   
@Override
public Capabilities convert(WebDriverProperties properties) {
    OperaOptions operaOptions = new OperaOptions();

    // general options for logging purpose
    operaOptions.setCapability(CAPABILITY_AUTOCLOSE, properties.isAutoClose());
    addToOperaOptionsIfNoEmptyValue(operaOptions, CAPABILITY_DRIVER_VERSION, properties.getDriverVersion());
    addToOperaOptionsIfNoEmptyValue(operaOptions, CAPABILITY_BROWSER_SIZE, properties.getBrowserSize());

    return operaOptions;
}
项目:selenium-jupiter    文件:DockerDriverHandler.java   
private DesiredCapabilities getCapabilities(BrowserType browser,
        boolean enableVnc) throws IllegalAccessException, IOException {
    DesiredCapabilities capabilities = browser.getCapabilities();
    if (enableVnc) {
        capabilities.setCapability("enableVNC", true);
        capabilities.setCapability("screenResolution",
                getString("sel.jup.vnc.screen.resolution"));
    }

    if (recording) {
        capabilities.setCapability("enableVideo", true);
        capabilities.setCapability("videoScreenSize",
                getString("sel.jup.recording.video.screen.size"));
        capabilities.setCapability("videoFrameRate",
                getInt("sel.jup.recording.video.frame.rate"));
    }

    Optional<Capabilities> optionalCapabilities = annotationsReader
            .getCapabilities(parameter, testInstance);
    MutableCapabilities options = browser.getDriverHandler()
            .getOptions(parameter, testInstance);

    // Due to bug in operablink the binary path must be set
    if (browser == OPERA) {
        ((OperaOptions) options).setBinary("/usr/bin/opera");
    }

    if (optionalCapabilities.isPresent()) {
        options.merge(optionalCapabilities.get());
    }
    capabilities.setCapability(browser.getOptionsKey(), options);
    log.trace("Using capabilities for Docker browser {}", capabilities);
    return capabilities;
}
项目: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"));
}
项目: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    文件:OperaCapabilitiesConverter.java   
private void addToOperaOptionsIfNoEmptyValue(OperaOptions operaOptions, String key, String value) {
    if (isNotEmpty(value)) {
        operaOptions.setCapability(key, value);
    }
}
项目: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);
}
项目:easyium-java    文件:OperaDriver.java   
/**
 * Creates a new OperaDriver instance with the specified options.
 *
 * @param options The options to use.
 * @see #OperaDriver(OperaDriverService, OperaOptions)
 */
public OperaDriver(OperaOptions options) {
    super(new org.openqa.selenium.opera.OperaDriver(options));
}
项目:easyium-java    文件:OperaDriver.java   
/**
 * Creates a new OperaDriver instance with the specified options. The {@code service} will be
 * started along with the driver, and shutdown upon calling {@link #quit()}.
 *
 * @param service The service to use.
 * @param options The options to use.
 */
public OperaDriver(OperaDriverService service, OperaOptions options) {
    super(new org.openqa.selenium.opera.OperaDriver(service, options));
}