本文整理汇总了Java中org.openqa.selenium.Platform.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.toString方法的具体用法?Java Platform.toString怎么用?Java Platform.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.Platform
的用法示例。
在下文中一共展示了Platform.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlatform
import org.openqa.selenium.Platform; //导入方法依赖的package包/类
/**
* return the platform for the proxy. It should be the same for all slots of the proxy, so checking that.
* @return Either the platform name, "Unknown", "mixed OS", or "not specified".
*/
public static String getPlatform(RemoteProxy proxy) {
Platform res = null;
if (proxy.getTestSlots().size() == 0) {
return "Unknown";
} else {
res = getPlatform(proxy.getTestSlots().get(0));
}
for (TestSlot slot : proxy.getTestSlots()) {
Platform tmp = getPlatform(slot);
if (tmp != res) {
return "mixed OS";
} else {
res = tmp;
}
}
if (res == null) {
return "not specified";
} else {
return res.toString();
}
}
示例2: getPlatformName
import org.openqa.selenium.Platform; //导入方法依赖的package包/类
public String getPlatformName() {
if (runContext.Platform.equals(Platform.ANY) || runContext.Platform.equals(Platform.getCurrent())) {
Capabilities cap;
if (driver instanceof ExtendedHtmlUnitDriver) {
cap = ((ExtendedHtmlUnitDriver) driver).getCapabilities();
} else if (driver instanceof MobileDriver) {
cap = ((RemoteWebDriver) driver).getCapabilities();
Object platf = cap.getCapability("platformName");
if (platf != null && !platf.toString().isEmpty()) {
return platf.toString();
} else {
return (driver instanceof AndroidDriver) ? "Android" : "IOS";
}
} else if (driver instanceof EmptyDriver) {
return "Any";
} else {
cap = ((RemoteWebDriver) driver).getCapabilities();
}
Platform p = cap.getPlatform();
if (p.name().equals(Platform.VISTA.name()) || p.name().equals(Platform.XP.name())
|| p.name().equals(Platform.WINDOWS.name()) || p.name().equals(Platform.WIN8.name())) {
switch (p.getMajorVersion() + "." + p.getMinorVersion()) {
case "5.1":
return "XP";
case "6.0":
return "VISTA";
case "6.1":
return "WIN7";
case "6.2":
return "WIN8";
case "6.3":
return "WIN8.1";
default:
return p.name();
}
} else {
return p.toString();
}
} else if (runContext.PlatformValue.equals("WINDOWS")) {
return "WIN";
} else {
return runContext.PlatformValue;
}
}