本文整理汇总了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();
}