Java Code Examples for org.openqa.selenium.Platform#WINDOWS
The following examples show how to use
org.openqa.selenium.Platform#WINDOWS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestEnvironmentTest.java From senbot with MIT License | 6 votes |
@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)); }
Example 2
Source File: TestEnvironmentTest.java From senbot with MIT License | 6 votes |
@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(); }
Example 3
Source File: TestEnvironmentTest.java From senbot with MIT License | 6 votes |
@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(); }
Example 4
Source File: AssumeCapabilityTest.java From hifive-pitalium with Apache License 2.0 | 5 votes |
@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); }
Example 5
Source File: DriverFactoryTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void testShouldConsiderPlatform() { DesiredCapabilities windows = new DesiredCapabilities("browser", "v1", Platform.WINDOWS); DesiredCapabilities linux = new DesiredCapabilities("browser", "v1", Platform.LINUX); DriverProvider windowsProvider = mockDriverProviderFor(windows); DriverProvider linuxProvider = mockDriverProviderFor(linux); factory.registerDriverProvider(windowsProvider); factory.registerDriverProvider(linuxProvider); assertEquals(windowsProvider, factory.getProviderMatching(windows)); assertEquals(linuxProvider, factory.getProviderMatching(linux)); }
Example 6
Source File: CapabilitiesComparatorTest.java From selenium with Apache License 2.0 | 5 votes |
@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); }
Example 7
Source File: AssumeCapabilityTest.java From hifive-pitalium with Apache License 2.0 | 4 votes |
@CapabilityFilter(platform = Platform.WINDOWS) @Test public void familyParamWindows() throws Exception { assertAssumed(0, 3, 4); }
Example 8
Source File: AssumeCapabilityTest.java From hifive-pitalium with Apache License 2.0 | 4 votes |
@CapabilityFilter(platform = Platform.WINDOWS, browserName = { BrowserType.FIREFOX, BrowserType.CHROME }) @Test public void platformWindows_browserFirefoxChrome() throws Exception { assertAssumed(0, 1, 2, 5, 6, 7, 8); }
Example 9
Source File: Browser.java From kurento-java with Apache License 2.0 | 4 votes |
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); }