本文整理匯總了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);
}