當前位置: 首頁>>代碼示例>>Java>>正文


Java Platform.MAC屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:27,代碼來源:WebCapabilitiesBuilder.java

示例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;
}
 
開發者ID:fhoeben,項目名稱:hsac-fitnesse-fixtures,代碼行數:15,代碼來源:SeleniumHelper.java

示例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},
    };
}
 
開發者ID:jabbrwcky,項目名稱:selenium-api,代碼行數:13,代碼來源:PlatformMatcherTest.java

示例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);
}
 
開發者ID:hifive,項目名稱:hifive-pitalium,代碼行數:72,代碼來源:PtlWebDriverFactory.java


注:本文中的org.openqa.selenium.Platform.MAC屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。