本文整理汇总了Java中org.openqa.selenium.opera.OperaOptions类的典型用法代码示例。如果您正苦于以下问题:Java OperaOptions类的具体用法?Java OperaOptions怎么用?Java OperaOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperaOptions类属于org.openqa.selenium.opera包,在下文中一共展示了OperaOptions类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: settingBrowserSize
import org.openqa.selenium.opera.OperaOptions; //导入依赖的package包/类
@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());
}
示例2: resolve
import org.openqa.selenium.opera.OperaOptions; //导入依赖的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);
}
}
示例3: setupTest
import org.openqa.selenium.opera.OperaOptions; //导入依赖的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);
}
示例4: convert
import org.openqa.selenium.opera.OperaOptions; //导入依赖的package包/类
@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;
}
示例5: getCapabilities
import org.openqa.selenium.opera.OperaOptions; //导入依赖的package包/类
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;
}
示例6: testOperaOptions
import org.openqa.selenium.opera.OperaOptions; //导入依赖的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"));
}
示例7: setupOperaDriver
import org.openqa.selenium.opera.OperaOptions; //导入依赖的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));
}
示例8: addToOperaOptionsIfNoEmptyValue
import org.openqa.selenium.opera.OperaOptions; //导入依赖的package包/类
private void addToOperaOptionsIfNoEmptyValue(OperaOptions operaOptions, String key, String value) {
if (isNotEmpty(value)) {
operaOptions.setCapability(key, value);
}
}
示例9: createDriver
import org.openqa.selenium.opera.OperaOptions; //导入依赖的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);
}
示例10: OperaDriver
import org.openqa.selenium.opera.OperaOptions; //导入依赖的package包/类
/**
* 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));
}