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