当前位置: 首页>>代码示例>>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;未经允许,请勿转载。