List of usage examples for org.openqa.selenium Platform LINUX
Platform LINUX
To view the source code for org.openqa.selenium Platform LINUX.
Click Source Link
From source file:com.linagora.obm.ui.ioc.Module.java
License:Open Source License
private Capabilities buildDriverCapabilities() { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability("version", "17"); capabilities.setCapability("platform", Platform.LINUX); return capabilities; }
From source file:com.opera.core.systems.OperaDriverTest.java
License:Apache License
@Test @Ignore(products = CORE, value = "core does not support -pd") public void testSetProfile() throws Exception { if (!Platform.getCurrent().is(Platform.LINUX)) { return;/* w w w .j a v a 2s . c om*/ } FileHandler.delete(new File("/tmp/opera-test-profile/")); DesiredCapabilities c = new DesiredCapabilities(); c.setCapability(OperaDriver.PROFILE, "/tmp/opera-test-profile/"); TestOperaDriver a; try { a = new TestOperaDriver(c); } catch (Exception e) { // If immediately exited, then it doesn't support the flags if (e.getMessage().contains("Opera exited immediately")) { return; } else { throw e; } } String profile = a.preferences().get("User Prefs", "Opera Directory").toString(); assertEquals("/tmp/opera-test-profile/", profile); a.quit(); }
From source file:com.opera.core.systems.OperaRunnerSettingsTest.java
License:Apache License
@Test public void testSetDisplay() { Integer display = 8;/*from w w w . j av a 2 s .c o m*/ Exception unsupportedOperationException = null; try { settings.setDisplay(display); } catch (UnsupportedOperationException e) { unsupportedOperationException = e; } if (Platform.getCurrent() == Platform.WINDOWS) { assertNotNull(unsupportedOperationException); } else if (Platform.getCurrent() == Platform.LINUX || Platform.getCurrent() == Platform.UNIX) { assertNull(unsupportedOperationException); assertEquals(display, settings.getDisplay()); } }
From source file:com.opera.core.systems.runner.OperaRunnerSettings.java
License:Apache License
public void setDisplay(Integer display) throws UnsupportedOperationException { if (!Platform.getCurrent().is(Platform.LINUX)) { throw new UnsupportedOperationException("Unsupported operating system: " + Platform.getCurrent()); }/* w ww .j av a 2 s.co m*/ this.display = display; }
From source file:com.photon.phresco.Screens.BaseScreen.java
License:Apache License
public void instantiateBrowser(String selectedBrowser, String selectedPlatform, String applicationURL, String applicationContext) throws ScreenException, MalformedURLException { URL server = new URL("http://localhost:4444/wd/hub/"); if (selectedBrowser.equalsIgnoreCase(Constants.BROWSER_CHROME)) { log.info("-------------***LAUNCHING GOOGLECHROME***--------------"); try {/* ww w . j a va2s .c o m*/ capabilities = new DesiredCapabilities(); capabilities.setBrowserName("chrome"); } catch (Exception e) { e.printStackTrace(); } } else if (selectedBrowser.equalsIgnoreCase(Constants.BROWSER_IE)) { log.info("---------------***LAUNCHING INTERNET EXPLORE***-----------"); try { capabilities = new DesiredCapabilities(); capabilities.setJavascriptEnabled(true); capabilities.setBrowserName("iexplorer"); } catch (Exception e) { e.printStackTrace(); } } else if (selectedBrowser.equalsIgnoreCase(Constants.BROWSER_OPERA)) { log.info("-------------***LAUNCHING OPERA***--------------"); try { capabilities = new DesiredCapabilities(); capabilities.setBrowserName("opera"); capabilities.setCapability("opera.autostart ", true); System.out.println("-----------checking the OPERA-------"); } catch (Exception e) { e.printStackTrace(); } } else if (selectedBrowser.equalsIgnoreCase(Constants.BROWSER_SAFARI)) { log.info("-------------***LAUNCHING SAFARI***--------------"); try { capabilities = new DesiredCapabilities(); capabilities.setBrowserName("safari"); /* capabilities.setCapability("safari.autostart ", true);*/ System.out.println("-----------checking the SAFARI-------"); } catch (Exception e) { e.printStackTrace(); } } else if (selectedBrowser.equalsIgnoreCase(Constants.BROWSER_FIREFOX)) { log.info("-------------***LAUNCHING FIREFOX***--------------"); capabilities = new DesiredCapabilities(); capabilities.setBrowserName("firefox"); } else if (selectedBrowser.equalsIgnoreCase(Constants.HTML_UNIT_DRIVER)) { log.info("-------------***HTML_UNIT_DRIVER***--------------"); capabilities = new DesiredCapabilities(); capabilities.setBrowserName("htmlunit"); /*URL server = new URL("http://testVM:4444/wd/hub"); new RemoteWebDriver(new Url("http://testVM:4444/wd/hub");*/ System.out.println("-----------checking the HTML_UNIT_DRIVER-------"); // break; // driver = new RemoteWebDriver(server, capabilities); } else { throw new ScreenException("------Only FireFox,InternetExplore and Chrome works-----------"); } if (selectedPlatform.equalsIgnoreCase("WINDOWS")) { capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS); } else if (selectedPlatform.equalsIgnoreCase("LINUX")) { capabilities.setCapability(CapabilityType.PLATFORM, Platform.LINUX); } else if (selectedPlatform.equalsIgnoreCase("MAC")) { capabilities.setCapability(CapabilityType.PLATFORM, Platform.MAC); } driver = new RemoteWebDriver(server, capabilities); driver.get(applicationURL + applicationContext); }
From source file:com.rmn.qa.AutomationCapabilityMatcherTest.java
License:Open Source License
@Test public void testNodeNotInContext() { AutomationCapabilityMatcher matcher = new AutomationCapabilityMatcher(); Map<String, Object> nodeCapability = new HashMap<String, Object>(); nodeCapability.put(CapabilityType.BROWSER_NAME, "firefox"); nodeCapability.put(AutomationConstants.INSTANCE_ID, "foobar"); Map<String, Object> testCapability = new HashMap<String, Object>(); testCapability.put(CapabilityType.BROWSER_NAME, "firefox"); AutomationDynamicNode node = new AutomationDynamicNode("uuid", "foo", "browser", Platform.LINUX, new Date(), 10);//from www .jav a2 s .c om node.updateStatus(AutomationDynamicNode.STATUS.EXPIRED); Assert.assertTrue("Capabilities should match as node is not in context", matcher.matches(nodeCapability, testCapability)); }
From source file:com.rmn.qa.AutomationCapabilityMatcherTest.java
License:Open Source License
@Test public void testExpiredNode() { AutomationCapabilityMatcher matcher = new AutomationCapabilityMatcher(); Map<String, Object> nodeCapability = new HashMap<String, Object>(); nodeCapability.put(CapabilityType.BROWSER_NAME, "firefox"); nodeCapability.put(AutomationConstants.INSTANCE_ID, "foo"); Map<String, Object> testCapability = new HashMap<String, Object>(); testCapability.put(CapabilityType.BROWSER_NAME, "firefox"); AutomationDynamicNode node = new AutomationDynamicNode("uuid", "foo", "browser", Platform.LINUX, new Date(), 10);/* w ww . j a va2 s.c o m*/ AutomationContext.getContext().addNode(node); node.updateStatus(AutomationDynamicNode.STATUS.EXPIRED); Assert.assertFalse("Capabilities should match as node is not in context", matcher.matches(nodeCapability, testCapability)); }
From source file:com.rmn.qa.AutomationCapabilityMatcherTest.java
License:Open Source License
@Test public void testTerminatedNode() { AutomationCapabilityMatcher matcher = new AutomationCapabilityMatcher(); Map<String, Object> nodeCapability = new HashMap<String, Object>(); nodeCapability.put(CapabilityType.BROWSER_NAME, "firefox"); nodeCapability.put(AutomationConstants.INSTANCE_ID, "foo"); Map<String, Object> testCapability = new HashMap<String, Object>(); testCapability.put(CapabilityType.BROWSER_NAME, "firefox"); AutomationDynamicNode node = new AutomationDynamicNode("uuid", "foo", "browser", Platform.LINUX, new Date(), 10);// www . ja v a2s.c o m AutomationContext.getContext().addNode(node); node.updateStatus(AutomationDynamicNode.STATUS.TERMINATED); Assert.assertFalse("Capabilities should match as node is not in context", matcher.matches(nodeCapability, testCapability)); }
From source file:com.rmn.qa.AutomationRequestMatcherTest.java
License:Open Source License
@Test // Tests that OS matching on a node works correctly public void testRequestMatchingOs() throws IOException, ServletException { String browser = "firefox"; Platform os = Platform.LINUX; String nodeId = "nodeId"; // Add a node that is not running to make sure its not included in the available calculation AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50); AutomationContext.getContext().addNode(node); ProxySet proxySet = new ProxySet(false); MockRemoteProxy proxy = new MockRemoteProxy(); proxy.setMaxNumberOfConcurrentTestSessions(50); proxy.setCapabilityMatcher(new AutomationCapabilityMatcher()); Map<String, Object> config = Maps.newHashMap(); config.put(AutomationConstants.INSTANCE_ID, nodeId); proxy.setConfig(config);//from www. j a v a 2s . c o m Map<String, Object> capabilities = Maps.newHashMap(); capabilities.put(CapabilityType.BROWSER_NAME, "firefox"); capabilities.put(CapabilityType.PLATFORM, os); TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities); proxy.setMultipleTestSlots(testSlot, 10); proxySet.add(proxy); AutomationContext.getContext().setTotalNodeCount(50); int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet, new AutomationRunRequest(null, null, browser, null, os)); Assert.assertEquals("Thread count should be correct due to matching OS", 10, freeThreads); }
From source file:com.rmn.qa.AutomationRequestMatcherTest.java
License:Open Source License
@Test // Tests that OS NOT matching on a node works correctly public void testRequestNonMatchingOs() throws IOException, ServletException { String browser = "firefox"; Platform os = Platform.LINUX; String nodeId = "nodeId"; // Add a node that is not running to make sure its not included in the available calculation AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50); AutomationContext.getContext().addNode(node); ProxySet proxySet = new ProxySet(false); MockRemoteProxy proxy = new MockRemoteProxy(); proxy.setMaxNumberOfConcurrentTestSessions(50); proxy.setCapabilityMatcher(new AutomationCapabilityMatcher()); Map<String, Object> config = Maps.newHashMap(); config.put(AutomationConstants.INSTANCE_ID, nodeId); proxy.setConfig(config);//from w w w . j ava 2s .c o m Map<String, Object> capabilities = Maps.newHashMap(); capabilities.put(CapabilityType.BROWSER_NAME, "firefox"); capabilities.put(CapabilityType.PLATFORM, Platform.WINDOWS); TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities); proxy.setMultipleTestSlots(testSlot, 10); proxySet.add(proxy); AutomationContext.getContext().setTotalNodeCount(50); int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet, new AutomationRunRequest(null, null, browser, null, os)); Assert.assertEquals("Thread count should be 0 due to non-matching OS", 0, freeThreads); }