当前位置: 首页>>代码示例>>Java>>正文


Java Platform.WINDOWS属性代码示例

本文整理汇总了Java中org.openqa.selenium.Platform.WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java Platform.WINDOWS属性的具体用法?Java Platform.WINDOWS怎么用?Java Platform.WINDOWS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.openqa.selenium.Platform的用法示例。


在下文中一共展示了Platform.WINDOWS属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEquals_OS

@Test
public void testEquals_OS() {
    TestEnvironment left = new TestEnvironment(null, null, Platform.WINDOWS);
    TestEnvironment right = new TestEnvironment(null, null, Platform.WINDOWS);

    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.LINUX);
    assertFalse(left.matches(right));

    right = new TestEnvironment(null, null, Platform.XP);
    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.VISTA);
    assertTrue(left.matches(right));

    right = new TestEnvironment(null, null, Platform.ANY);
    assertTrue(left.matches(right));
}
 
开发者ID:gfk-ba,项目名称:senbot,代码行数:19,代码来源:TestEnvironmentTest.java

示例2: testCleanupDriver

@Test
public void testCleanupDriver() throws Throwable {
	final WebDriver webDriver = mock(WebDriver.class);
	TestEnvironment env = new TestEnvironment(null, null, Platform.WINDOWS){
		@Override
		public WebDriver getWebDriver(){
			return webDriver;
		}
	};
	
	assertEquals(webDriver, env.getWebDriver());
	
	env.cleanupDriver();
	
	verify(webDriver, times(1)).quit();
	env.cleanupAllDrivers();
}
 
开发者ID:gfk-ba,项目名称:senbot,代码行数:17,代码来源:TestEnvironmentTest.java

示例3: testIsWebDriverAccessedSince

@Test
public void testIsWebDriverAccessedSince() {
    TestEnvironment env = new TestEnvironment(TestEnvironment.FF, null, Platform.WINDOWS);
  
    long beforeAccess = System.currentTimeMillis() - 1;
    assertFalse(env.isWebDriverAccessedSince(0));
    assertFalse(env.isWebDriverAccessedSince(beforeAccess));

    env.getWebDriver();
    assertTrue(env.isWebDriverAccessedSince(0));
    assertTrue(env.isWebDriverAccessedSince(beforeAccess));
    assertFalse(env.isWebDriverAccessedSince(System.currentTimeMillis()));
    
    env.cleanupAllDrivers();
    
}
 
开发者ID:gfk-ba,项目名称:senbot,代码行数:16,代码来源:TestEnvironmentTest.java

示例4: addPlatform

@Override
public WebCapabilitiesBuilder addPlatform(final String platform)
{
    Platform platformName = null;

    switch (platform.toLowerCase())
    {
        case "windows":
            platformName = Platform.WINDOWS;
            break;
        case "xp":
            platformName = Platform.XP;
            break;
        case "linux":
            platformName = Platform.LINUX;
            break;
        case "mac":
            platformName = Platform.MAC;
            break;
        default:
            platformName = Platform.WINDOWS;
            break;
    }

    capabilities.setPlatform(platformName);
    return this;
}
 
开发者ID:pradeeptaswain,项目名称:oldmonk,代码行数:27,代码来源:WebCapabilitiesBuilder.java

示例5: multipleFilters

@CapabilityFilters({
		@CapabilityFilter(filterGroup = "pc", browserName = BrowserType.IE),
		@CapabilityFilter(platform = Platform.WINDOWS, browserName = { BrowserType.FIREFOX, BrowserType.CHROME }) })
@Test
public void multipleFilters() throws Exception {
	assertAssumed(2, 5, 6, 7, 8);
}
 
开发者ID:hifive,项目名称:hifive-pitalium,代码行数:7,代码来源:AssumeCapabilityTest.java

示例6: familyParamWindows

@CapabilityFilter(platform = Platform.WINDOWS)
@Test
public void familyParamWindows() throws Exception {
	assertAssumed(0, 3, 4);
}
 
开发者ID:hifive,项目名称:hifive-pitalium,代码行数:5,代码来源:AssumeCapabilityTest.java

示例7: platformWindows_browserFirefoxChrome

@CapabilityFilter(platform = Platform.WINDOWS, browserName = { BrowserType.FIREFOX, BrowserType.CHROME })
@Test
public void platformWindows_browserFirefoxChrome() throws Exception {
	assertAssumed(0, 1, 2, 5, 6, 7, 8);
}
 
开发者ID:hifive,项目名称:hifive-pitalium,代码行数:5,代码来源:AssumeCapabilityTest.java

示例8: initDriver

@Before
public void initDriver() throws Exception {
    if("local".equals(testType) || "all".equals(testType)) {
        if ("firefox".equals(targetBrowser)) {
            driver = new FirefoxDriver();
        }
        if ("chrome".equals(targetBrowser)) {
            driver = new ChromeDriver();
        }
    }

    OUTPUT_DIR = System.getProperty("BUILD_OUTPUT");

    name = readPropertyOrEnv("BUILD_TAG", getClass().getSimpleName());
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    desiredCapabilities.setCapability("name", name);
    
    if (targetPlatforme.equalsIgnoreCase("WINDOWS")) {
        platforme = Platform.WINDOWS;
    }
    desiredCapabilities.setCapability(CapabilityType.PLATFORM, platforme);
    desiredCapabilities.setJavascriptEnabled(true);
    if ("no".equals(videoCapture)) {
        desiredCapabilities.setCapability("record-video", false);
    }
    if ("no".equals(imageCapture)) {
        desiredCapabilities.setCapability("record-screenshots", false);
    }//we need this if use sauce lab integration
    //targetBrowser = readPropertyOrEnv("SELENIUM_BROWSER", targetBrowser);
    desiredCapabilities.setBrowserName(targetBrowser);
    System.out.println(System.getProperty("webdriver.chrome.driver"));
    if("htmlUnit".equals(testType)) {
        driver = new HtmlUnitDriver(desiredCapabilities);
    }
    LoggingPreferences logs = new LoggingPreferences(); 
    logs.enable(LogType.PROFILER, Level.INFO);
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);
    URL gridurl = new URL(gridHubUrl);
    
    if ("grid".equals(testType) || "all".equals(testType)) {
        driver = new RemoteWebDriver(gridurl, desiredCapabilities);
    }
    if (driver instanceof JavascriptExecutor) {
        js = (JavascriptExecutor) driver;
    }
    RemoteWebDriver rd = (RemoteWebDriver) driver;
    sessionId = rd.getSessionId().toString();
    rd.setLogLevel(Level.INFO);
    driver.manage().window().maximize();
    recordingStarted = startRecording();
    actions = new Actions(driver);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:52,代码来源:WebdriverTestCase.java

示例9: getAdvancedBrowserCapabilities

private DesiredCapabilities getAdvancedBrowserCapabilities(WTFBrowser browser) {
	return new DesiredCapabilities(browser.browserNameOnGrid,
			browser.version, browser.os != null ? browser.getPlatform()
					: Platform.WINDOWS);
}
 
开发者ID:web-auto,项目名称:wtf-core,代码行数:5,代码来源:WTFTest.java

示例10: createChromeBrowser

private void createChromeBrowser(DesiredCapabilities capabilities) throws MalformedURLException {

    if (scope == BrowserScope.LOCAL) {
      // Management of chromedriver
      ChromeDriverManager.getInstance().setup();
    }

    // Chrome options
    ChromeOptions options = new ChromeOptions();

    // Chrome extensions
    if (extensions != null && !extensions.isEmpty()) {

      for (Map<String, String> extension : extensions) {
        InputStream is = getExtensionAsInputStream(extension.values().iterator().next());
        if (is != null) {
          try {
            File crx = File.createTempFile(extension.keySet().iterator().next(), ".crx");
            FileUtils.copyInputStreamToFile(is, crx);
            options.addExtensions(crx);
          } catch (Throwable t) {
            log.error("Error loading Chrome extension {} ({} : {})", extension, t.getClass(),
                t.getMessage());
          }
        }
      }
    }

    if (enableScreenCapture) {
      // This flag enables the screen sharing
      options.addArguments("--enable-usermedia-screen-capturing");

      String windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT;
      if (platform != null
          && (platform == Platform.WINDOWS || platform == Platform.XP || platform == Platform.VISTA
              || platform == Platform.WIN8 || platform == Platform.WIN8_1)) {

        windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT_WIN;
      }
      options.addArguments("--auto-select-desktop-capture-source="
          + getProperty(TEST_SCREEN_SHARE_TITLE_PROPERTY, windowTitle));

    } else {
      // This flag avoids grant the camera
      options.addArguments("--use-fake-ui-for-media-stream");
    }

    // This flag avoids warning in Chrome. See:
    // https://code.google.com/p/chromedriver/issues/detail?id=799
    options.addArguments("--test-type");

    if (protocol == Protocol.FILE) {
      // This flag allows reading local files in video tags
      options.addArguments("--allow-file-access-from-files");
    }

    if (!usePhysicalCam) {
      // This flag makes using a synthetic video (green with
      // spinner) in WebRTC. Or it is needed to combine with
      // use-file-for-fake-video-capture to use a file faking the
      // cam
      options.addArguments("--use-fake-device-for-media-stream=fps=30");

      if (video != null && (isLocal() || isDocker())) {

        if (!Files.exists(Paths.get(video))) {
          throw new RuntimeException("Trying to create a browser using video file " + video
              + ", but this file doesn't exist.");
        }

        log.debug("Using video {} in browser {}", video, id);
        options.addArguments("--use-file-for-fake-video-capture=" + video);
      }
    }

    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());

    createDriver(capabilities, options);
  }
 
开发者ID:Kurento,项目名称:kurento-java,代码行数:80,代码来源:Browser.java


注:本文中的org.openqa.selenium.Platform.WINDOWS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。