本文整理汇总了Java中org.openqa.selenium.firefox.FirefoxOptions.setCapability方法的典型用法代码示例。如果您正苦于以下问题:Java FirefoxOptions.setCapability方法的具体用法?Java FirefoxOptions.setCapability怎么用?Java FirefoxOptions.setCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.firefox.FirefoxOptions
的用法示例。
在下文中一共展示了FirefoxOptions.setCapability方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: settingBrowserSize
import org.openqa.selenium.firefox.FirefoxOptions; //导入方法依赖的package包/类
@Test
public void settingBrowserSize() {
// given
WebDriverProperties properties = new WebDriverProperties();
properties.setProperty("browserSize", "1690x1000");
// when
Capabilities convertedCapabilities = firefoxCapabilitiesConverter.convert(properties);
// then
// expected safari options
FirefoxOptions expectedFirefoxOptions = new FirefoxOptions();
expectedFirefoxOptions.setCapability(CAPABILITY_AUTOCLOSE, false);
expectedFirefoxOptions.setCapability(CAPABILITY_BROWSER_SIZE, "1690x1000");
assertThat(convertedCapabilities.asMap()).isEqualTo(expectedFirefoxOptions.asMap());
}
示例2: getFirefoxOptions
import org.openqa.selenium.firefox.FirefoxOptions; //导入方法依赖的package包/类
private FirefoxOptions getFirefoxOptions() throws IOException {
String driverPath = getProperty("browser.driver.path");
if (!"".equals(driverPath)) {
System.setProperty("webdriver.gecko.driver", driverPath);
}
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.FATAL);
FirefoxProfile profile = getProfile();
if (profile == null) {
String version = getProperty("browser.version");
if (version != null) {
options.setCapability("version", version);
}
} else {
options.setProfile(profile);
}
return options;
}
示例3: configuration
import org.openqa.selenium.firefox.FirefoxOptions; //导入方法依赖的package包/类
@Override
public Capabilities configuration(final XmlConfig config) {
final FirefoxOptions options = new FirefoxOptions();
options.setCapability("enableVNC", true);
options.setCapability("name", config.getTestName());
options.setCapability("screenResolution", "1280x1024x24");
return merge(config, options);
}
示例4: convert
import org.openqa.selenium.firefox.FirefoxOptions; //导入方法依赖的package包/类
@Override
public Capabilities convert(WebDriverProperties properties) {
FirefoxOptions firefoxOptions = new FirefoxOptions();
// general options for logging purpose
firefoxOptions.setCapability(CAPABILITY_AUTOCLOSE, properties.isAutoClose());
addToFirefoxOptionsIfNoEmptyValue(firefoxOptions, CAPABILITY_DRIVER_VERSION, properties.getDriverVersion());
addToFirefoxOptionsIfNoEmptyValue(firefoxOptions, CAPABILITY_BROWSER_SIZE, properties.getBrowserSize());
return firefoxOptions;
}
示例5: addToFirefoxOptionsIfNoEmptyValue
import org.openqa.selenium.firefox.FirefoxOptions; //导入方法依赖的package包/类
private void addToFirefoxOptionsIfNoEmptyValue(FirefoxOptions firefoxOptions, String key, String value) {
if (isNotEmpty(value)) {
firefoxOptions.setCapability(key, value);
}
}