org.openqa.selenium.Platform#XP源码实例Demo

下面列出了org.openqa.selenium.Platform#XP 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: selenium-api   文件: PlatformMatcherTest.java
@DataProvider
public Object[][] external() {
    return new Object[][]{
            {"win7", Platform.VISTA},
            {"vista", Platform.VISTA},
            {"Vista", Platform.VISTA},
            {"win8_1", Platform.WIN8_1},
            {"XP", Platform.XP},
            {"Win7", Platform.VISTA},
            {"win7", Platform.VISTA},
            {"Windows Server 2012", Platform.WIN8},
            {"windows 8", Platform.WIN8},
            {"win8", Platform.WIN8},
            {"windows 8.1", Platform.WIN8_1},
            {"win8.1", Platform.WIN8_1},
            {null, null},
            {"w8", null},
            {Platform.ANDROID, Platform.ANDROID}
    };
}
 
源代码2 项目: senbot   文件: TestEnvironmentTest.java
@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));
}
 
源代码3 项目: selenium-api   文件: PlatformMatcherTest.java
@DataProvider
public Object[][] platforms() {
    return new Object[][]{
            {"win7", Platform.VISTA, true},
            {"win7", "windows 7", true},
            {"vista", Platform.VISTA, true},
            {"darwin", Platform.MAC, true},
            {Platform.ANY, Platform.LINUX, true},
            {"linux", Platform.LINUX, true},
            {"linux", Platform.UNIX, false},
            {null, Platform.XP, true},
    };
}
 
源代码4 项目: selenium   文件: DriverFactoryTest.java
@Test
public void testShouldMatchAgainstAnyPlatformWhenRequestingAny() {
  DesiredCapabilities windowsVista = new DesiredCapabilities("browser", "v1", Platform.VISTA);
  DesiredCapabilities windowsXp = new DesiredCapabilities("browser", "v1", Platform.XP);
  DesiredCapabilities anyWindows = new DesiredCapabilities("browser", "v1", Platform.ANY);

  DriverProvider provider = mockDriverProviderFor(windowsVista);

  factory.registerDriverProvider(provider);

  assertEquals(provider, factory.getProviderMatching(windowsVista));
  assertEquals(provider, factory.getProviderMatching(anyWindows));
  assertEquals("Should always get a match if a driver has been registered",
               provider, factory.getProviderMatching(windowsXp));
}
 
源代码5 项目: selenium   文件: CapabilitiesComparatorTest.java
@Test
public void pickingVistaFromVariousLists() {
  Capabilities any = capabilities(BrowserType.IE, "", Platform.ANY, true);
  Capabilities windows = capabilities(BrowserType.IE, "", Platform.WINDOWS, true);
  Capabilities xp = capabilities(BrowserType.IE, "", Platform.XP, true);
  Capabilities vista = capabilities(BrowserType.IE, "", Platform.VISTA, true);

  Platform current = Platform.WINDOWS;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);

  current = Platform.VISTA;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(any, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);

  current = Platform.XP;
  assertThat(getBestMatch(vista, singletonList(any), current)).isEqualTo(any);
  assertThat(getBestMatch(vista, asList(any, windows), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(any, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, asList(windows, xp), current)).isEqualTo(windows);
  assertThat(getBestMatch(vista, asList(xp, vista), current)).isEqualTo(vista);
  assertThat(getBestMatch(vista, singletonList(xp), current)).isEqualTo(xp);
  assertThat(getBestMatch(vista, singletonList(vista), current)).isEqualTo(vista);
}
 
源代码6 项目: kurento-java   文件: Browser.java
private void createChromeBrowser(DesiredCapabilities capabilities) throws MalformedURLException {

    if (scope == BrowserScope.LOCAL) {
      // Management of chromedriver
      WebDriverManager.chromedriver().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");

    // To avoid problems with DevToolsActivePort
    options.addArguments("--no-sandbox");

    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() || isElastest())) {

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

        File videoFile = new File(video);
        log.debug("Using video {} in browser {} (exists {}, {} bytes, can read {})", video, id,
            videoFile.exists(), videoFile.length(), videoFile.canRead());
        options.addArguments("--use-file-for-fake-video-capture=" + video);
      }
    }

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

    createDriver(capabilities, options);
  }