本文整理汇总了Java中org.openqa.selenium.Platform.MAC属性的典型用法代码示例。如果您正苦于以下问题:Java Platform.MAC属性的具体用法?Java Platform.MAC怎么用?Java Platform.MAC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openqa.selenium.Platform
的用法示例。
在下文中一共展示了Platform.MAC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPlatform
@Override
public WebCapabilitiesBuilder addPlatform(final String platform)
{
Platform platformName = null;
switch (platform.toLowerCase())
{
case "windows":
platformName = Platform.WINDOWS;
break;
case "xp":
platformName = Platform.XP;
break;
case "linux":
platformName = Platform.LINUX;
break;
case "mac":
platformName = Platform.MAC;
break;
default:
platformName = Platform.WINDOWS;
break;
}
capabilities.setPlatform(platformName);
return this;
}
示例2: connectedToMac
/**
* @return whether current driver connects to browser on a Mac
*/
public boolean connectedToMac() {
boolean isMac;
WebDriver driver = driver();
if (driver instanceof RemoteWebDriver) {
RemoteWebDriver remoteWebDriver = (RemoteWebDriver) driver;
Platform platform = remoteWebDriver.getCapabilities().getPlatform();
isMac = Platform.MAC == platform || Platform.MAC == platform.family();
} else {
isMac = SystemUtils.IS_OS_MAC;
}
return isMac;
}
示例3: platforms
@DataProvider
public Object[][] platforms() {
return new Object[][]{
{"win7", Platform.VISTA, true},
{"win7", "windows 7", true},
{"vista", Platform.VISTA, true},
{"darwin", Platform.MAC, true},
{Platform.ANY, Platform.LINUX, true},
{"linux", Platform.LINUX, true},
{"linux", Platform.UNIX, false},
{null, Platform.XP, true},
};
}
示例4: getInstance
/**
* ブラウザに対応する{@link PtlWebDriverFactory}のインスタンスを取得します。
*
* @param capabilities Capability(ブラウザの情報を含む)
* @return {@link PtlWebDriverFactory}のインスタンス
*/
public static PtlWebDriverFactory getInstance(PtlCapabilities capabilities) {
PtlTestConfig config = PtlTestConfig.getInstance();
EnvironmentConfig environmentConfig = config.getEnvironment();
TestAppConfig testAppConfig = config.getTestAppConfig();
String browserName = Strings.nullToEmpty(capabilities.getBrowserName()).toLowerCase(Locale.ENGLISH);
// IE
if ("internet explorer".equals(browserName)) {
String version = Strings.nullToEmpty(capabilities.getVersion());
if (version.startsWith("7")) {
return new PtlInternetExplorer7DriverFactory(environmentConfig, testAppConfig, capabilities);
}
if (version.startsWith("8")) {
return new PtlInternetExplorer8DriverFactory(environmentConfig, testAppConfig, capabilities);
}
return new PtlInternetExplorerDriverFactory(environmentConfig, testAppConfig, capabilities);
}
// Edge
if ("microsoftedge".equals(browserName)) {
return new PtlEdgeDriverFactory(environmentConfig, testAppConfig, capabilities);
}
// Android
if (capabilities.getPlatform() == Platform.ANDROID) {
// Selendroid (Android 2.3+)
String automationName = (String) capabilities.getCapability("automationName");
if (automationName != null && "selendroid".equalsIgnoreCase(automationName)) {
return new PtlSelendroidDriverFactory(environmentConfig, testAppConfig, capabilities);
}
// Default (Android 4.2+)
return new PtlAndroidDriverFactory(environmentConfig, testAppConfig, capabilities);
}
// Chrome
if ("chrome".equals(browserName)) {
return new PtlChromeWebDriverFactory(environmentConfig, testAppConfig, capabilities);
}
// Safari
if ("safari".equals(browserName)) {
// MacOSX
if (capabilities.getPlatform() == Platform.MAC) {
return new PtlSafariDriverFactory(environmentConfig, testAppConfig, capabilities);
}
String deviceName = capabilities.getDeviceName();
if (Strings.isNullOrEmpty(deviceName)) {
throw new TestRuntimeException("\"deviceName\" is required for iOS devices");
}
if (deviceName.contains("iPad")) {
return new PtlIPadDriverFactory(environmentConfig, testAppConfig, capabilities);
}
if (deviceName.contains("iPhone")) {
return new PtlIPhoneDriverFactory(environmentConfig, testAppConfig, capabilities);
}
throw new TestRuntimeException("Unknown deviceName \"" + deviceName + "\"");
}
// Other
return new PtlFirefoxWebDriverFactory(environmentConfig, testAppConfig, capabilities);
}