當前位置: 首頁>>代碼示例>>Java>>正文


Java Platform.getCurrent方法代碼示例

本文整理匯總了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;
	}
}
 
開發者ID:aminmf,項目名稱:crawljax,代碼行數:17,代碼來源:FirefoxLinuxCrash.java

示例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;
}
 
開發者ID:selendroid,項目名稱:selendroid,代碼行數:23,代碼來源:JavaSdk.java

示例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) {
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:JavaDriverTest.java

示例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) {
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:JavaDriverTest.java

示例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"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:8,代碼來源:JavaDriverTest.java

示例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"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:8,代碼來源:JavaDriverTest.java

示例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);
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:9,代碼來源:SeleniumDriver.java

示例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);
}
 
開發者ID:robinsteel,項目名稱:Sqawsh,代碼行數:15,代碼來源:RunIpadAcceptanceTests.java

示例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);
}
 
開發者ID:robinsteel,項目名稱:Sqawsh,代碼行數:15,代碼來源:RunSafariAcceptanceTests.java

示例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);
}
 
開發者ID:robinsteel,項目名稱:Sqawsh,代碼行數:16,代碼來源:RunFirefoxAcceptanceTests.java

示例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";
	}
}
 
開發者ID:adi4test,項目名稱:WebAuto,代碼行數:12,代碼來源:DriverFactory.java

示例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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:6,代碼來源:JavaDriverTest.java

示例13: DefaultDriverSessions

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public DefaultDriverSessions() {
  this(Platform.getCurrent(), new DefaultDriverFactory());
}
 
開發者ID:alexkogon,項目名稱:grid-refactor-remote-server,代碼行數:4,代碼來源:DefaultDriverSessions.java

示例14: isSupportedPlatform

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private Platform isSupportedPlatform() {
	return Platform.getCurrent();

}
 
開發者ID:confsoft,項目名稱:FuncaoWeb,代碼行數:5,代碼來源:DriverSafari.java


注:本文中的org.openqa.selenium.Platform.getCurrent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。