本文整理匯總了Java中org.openqa.selenium.Platform.getCurrent方法的典型用法代碼示例。如果您正苦於以下問題:Java Platform.getCurrent方法的具體用法?Java Platform.getCurrent怎麽用?Java Platform.getCurrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openqa.selenium.Platform
的用法示例。
在下文中一共展示了Platform.getCurrent方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPosix
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private boolean onPosix() {
Platform current = Platform.getCurrent();
switch (current) {
case LINUX:
case UNIX:
return true;
case MAC:
case ANY:
case VISTA:
case WINDOWS:
case XP:
case ANDROID:
default:
return false;
}
}
示例2: javaHome
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public static String javaHome() {
if (javaHome == null) {
// Sniff JAVA_HOME first
javaHome = System.getenv("JAVA_HOME");
// If that's not present, and we're on a Mac...
if (javaHome == null && Platform.getCurrent() == MAC) {
try {
javaHome = ShellCommand.exec(new CommandLine("/usr/libexec/java_home"));
if (javaHome != null) {
javaHome = javaHome.replaceAll("\\r|\\n", "");
}
} catch (ShellCommandException e) {}
}
// Finally, check java.home, though this may point to a JRE.
if (javaHome == null) {
javaHome = System.getProperty("java.home");
}
}
return javaHome;
}
示例3: failsWhenRequestingANonJavaDriver
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void failsWhenRequestingANonJavaDriver() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities("xjava", "1.0", Platform.getCurrent());
try {
driver = new JavaDriver(caps, caps);
throw new MissingException(SessionNotCreatedException.class);
} catch (SessionNotCreatedException e) {
}
}
示例4: failsWhenRequestingUnsupportedCapability
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void failsWhenRequestingUnsupportedCapability() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities("java", "1.0", Platform.getCurrent());
caps.setCapability("rotatable", true);
try {
driver = new JavaDriver(caps, caps);
throw new MissingException(SessionNotCreatedException.class);
} catch (SessionNotCreatedException e) {
}
}
示例5: succeedsWhenRequestingNativeEventsCapability
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void succeedsWhenRequestingNativeEventsCapability() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities("java", "1.0", Platform.getCurrent());
caps.setCapability("nativeEvents", true);
driver = new JavaDriver(caps, caps);
Capabilities capabilities = ((RemoteWebDriver) driver).getCapabilities();
AssertJUnit.assertTrue(capabilities.is("nativeEvents"));
}
示例6: succeedsWhenRequestingNonNativeEventsCapability
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void succeedsWhenRequestingNonNativeEventsCapability() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities("java", "1.0", Platform.getCurrent());
caps.setCapability("nativeEvents", false);
driver = new JavaDriver(caps, caps);
Capabilities capabilities = ((RemoteWebDriver) driver).getCapabilities();
AssertJUnit.assertTrue(!capabilities.is("nativeEvents"));
}
示例7: launchDriver
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void launchDriver(String browser) throws UnCaughtException {
RunContext context = new RunContext();
context.BrowserName = browser;
context.Browser = Browser.fromString(browser);
context.Platform = Platform.getCurrent();
context.BrowserVersion = "default";
launchDriver(context);
}
示例8: setupSquashWebsiteUrl
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
@BeforeClass
public static void setupSquashWebsiteUrl() {
Platform current = Platform.getCurrent();
Assert.assertTrue("Safari can be used only on MAC and Windows platforms",
Platform.MAC.is(current) || Platform.WINDOWS.is(current));
Properties p = new Properties(System.getProperties());
p.setProperty("SquashWebsiteBaseUrl",
"http://squashwebsite.s3-website-eu-west-1.amazonaws.com/?selectedDate=2016-01-16.html");
// This will be read before each scenario to set up the webdriver
p.setProperty("WebDriverType", "Ipad");
p.setProperty("WebDriverJavascriptEnabled", "true");
System.setProperties(p);
}
示例9: setupSquashWebsiteUrl
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
@BeforeClass
public static void setupSquashWebsiteUrl() {
Platform current = Platform.getCurrent();
Assert.assertTrue("Safari can be used only on MAC and Windows platforms",
Platform.MAC.is(current) || Platform.WINDOWS.is(current));
Properties p = new Properties(System.getProperties());
p.setProperty("SquashWebsiteBaseUrl",
"http://squashwebsite.s3-website-eu-west-1.amazonaws.com/?selectedDate=2016-01-11.html");
// This will be read before each scenario to set up the webdriver
p.setProperty("WebDriverType", "Safari");
p.setProperty("WebDriverJavascriptEnabled", "true");
System.setProperties(p);
}
示例10: setupSquashWebsiteUrl
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
@BeforeClass
public static void setupSquashWebsiteUrl() {
Platform current = Platform.getCurrent();
Assert.assertTrue("Safari can be used only on MAC and Windows platforms",
Platform.MAC.is(current) || Platform.WINDOWS.is(current));
Properties p = new Properties(System.getProperties());
p.setProperty("SquashWebsiteBaseUrl",
"http://squashwebsite.s3-website-eu-west-1.amazonaws.com/?selectedDate=2016-01-11.html");
// This will be read before each scenario to set up the webdriver
p.setProperty("WebDriverType", "Firefox");
p.setProperty("webdriver.firefox.bin", "/Applications/Firefox.app/Contents/MacOS/firefox-bin");
p.setProperty("WebDriverJavascriptEnabled", "true");
System.setProperties(p);
}
示例11: getExtension
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private static String getExtension() {
Platform current = Platform.getCurrent();
if (Platform.MAC.is(current)) {
return "";
} else if (Platform.LINUX.is(current)) {
return "";
} else { // TODO after 2.43.1 Platform.WINDOWS was not working . quick fix
return ".exe";
}
}
示例12: supportsJavascriptEnabledCapability
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public void supportsJavascriptEnabledCapability() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities("java", "1.0", Platform.getCurrent());
caps.setJavascriptEnabled(true);
driver = new JavaDriver(caps, caps);
}
示例13: DefaultDriverSessions
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public DefaultDriverSessions() {
this(Platform.getCurrent(), new DefaultDriverFactory());
}
示例14: isSupportedPlatform
import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private Platform isSupportedPlatform() {
return Platform.getCurrent();
}