List of usage examples for org.openqa.selenium Platform ANY
Platform ANY
To view the source code for org.openqa.selenium Platform ANY.
Click Source Link
From source file:com.googlecode.ounit.selenium.WebDriverFactory.java
License:Open Source License
public static WebDriver newInstance(Browser b) { switch (b) {//from ww w . j av a 2 s . com case FIREFOX: return new FirefoxDriver(); case CHROME: return new ChromeDriver(); case IE: return new InternetExplorerDriver(); case HTMLUNIT: /* * Make sure we have a fully capable HtmlUnitDriver and * silence the stupid warnings about text/javascript */ HtmlUnitDriver rv = new HtmlUnitDriver(new DesiredCapabilities("htmlunit", "firefox", Platform.ANY)) { @Override protected WebClient modifyWebClient(WebClient client) { final IncorrectnessListener delegate = client.getIncorrectnessListener(); client.setIncorrectnessListener(new IncorrectnessListener() { @Override public void notify(String message, Object origin) { if (message.contains("Obsolete") && message.contains("/javascript")) return; delegate.notify(message, origin); } }); return super.modifyWebClient(client); } }; return rv; default: throw new IllegalArgumentException("Invalid browser specified"); } }
From source file:com.machinepublishers.jbrowserdriver.CapabilitiesServer.java
License:Apache License
/** * {@inheritDoc} */ @Override public Platform getPlatform() { return Platform.ANY; }
From source file:com.machinepublishers.jbrowserdriver.SeleniumProvider.java
License:Apache License
public SeleniumProvider() { super(new DesiredCapabilities("jbrowserdriver", "1", Platform.ANY), JBrowserDriver.class); }
From source file:com.opera.core.systems.OperaDriverTestRunner.java
License:Apache License
/** * Determines whether a test should be ignored or not based on a JUnit ignore annotation rule. The * check for this is mutually exclusive, meaning that if <em>either</em> the product or the * platform is true, the test will be ignored. * * @param ignoreAnnotation a custom ignore annotation * @return true if test should be ignored, false otherwise *///from ww w . j a v a2s.c o m private boolean shouldIgnore(Ignore ignoreAnnotation) { if (ignoreAnnotation == null) { return false; } // If it's a plain old @Ignore without arguments if (ignoreAnnotation.products().length == 0 && ignoreAnnotation.platforms().length == 0) { return true; } for (OperaProduct product : ignoreAnnotation.products()) { if (product.is(OperaProduct.ALL)) { break; } else if (product.is(OperaDriverTestCase.currentProduct)) { return true; } } for (Platform platform : ignoreAnnotation.platforms()) { if (platform.is(Platform.ANY)) { return true; //} else if (OperaDriverTestCase.currentPlatform.is(platform)) { } else if (platform.is(OperaDriverTestCase.currentPlatform)) { return true; } } // Should not be ignored, none of the rules apply return false; }
From source file:com.rmn.qa.AutomationRunRequestTest.java
License:Open Source License
@Test // Tests that a platform of 'ANY' matches another otherwise non-matching OS public void testOsMatchesAnyRequests() { String uuid = "testUuid"; String browser = "firefox"; String browserVersion = "25"; Platform os = Platform.ANY; Map<String, Object> map = new HashMap<>(); map.put(CapabilityType.BROWSER_NAME, browser); map.put(CapabilityType.VERSION, browserVersion); map.put(CapabilityType.PLATFORM, os.toString()); AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, Platform.LINUX); AutomationRunRequest second = AutomationRunRequest.requestFromCapabilities(map); Assert.assertTrue("Requests should be equal", first.matchesCapabilities(second)); Assert.assertTrue("Requests should be equal", second.matchesCapabilities(first)); }
From source file:com.rmn.qa.AutomationRunRequestTest.java
License:Open Source License
@Test // Tests that a platform of 'ANY' matches another otherwise non-matching OS public void testOsMatchesAnyCapability() { String uuid = "testUuid"; String browser = "firefox"; String browserVersion = "25"; Platform os = Platform.ANY; Map<String, Object> capabilities = new HashMap<>(); capabilities.put(CapabilityType.BROWSER_NAME, browser); capabilities.put(CapabilityType.VERSION, browserVersion); capabilities.put(CapabilityType.PLATFORM, os.toString()); AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, Platform.LINUX); Assert.assertTrue("Requests should be equal", first.matchesCapabilities(capabilities)); }
From source file:com.rmn.qa.AutomationUtils.java
License:Open Source License
/** * Returns true if the requested browser and platform can be used within AMIs, and false otherwise * @param browserPair/*w ww . j a v a 2s.c o m*/ * @return */ public static boolean browserAndPlatformSupported(BrowserPlatformPair browserPair) { // If no platform is defined or the user specifies linux, perform the browser check. if (AutomationUtils.isPlatformUnix(browserPair.getPlatform())) { return lowerCaseMatch(BrowserType.CHROME, browserPair.getBrowser()) || lowerCaseMatch(BrowserType.FIREFOX, browserPair.getBrowser()); } else if (browserPair.getPlatform() == Platform.ANY || AutomationUtils.isPlatformWindows(browserPair.getPlatform())) { return lowerCaseMatch(BrowserType.CHROME, browserPair.getBrowser()) || lowerCaseMatch(BrowserType.FIREFOX, browserPair.getBrowser()) || lowerCaseMatch("internetexplorer", browserPair.getBrowser()); } else { return false; } }
From source file:com.rmn.qa.AutomationUtils.java
License:Open Source License
/** * Returns true if the platforms match. If either platform is Platform.ANY, this will return true. * @param platformOne/*from w ww . j ava 2 s.c o m*/ * @param platformTwo * @return */ // Even though we're handling null in here, this shouldn't really happen unless someone has a mis-configured test request or // manually connects a node to this hub with a mis-configured JSON file. Unfortunately, there is not a lot we can do to prevent // this besides handling it here public static boolean firstPlatformCanBeFulfilledBySecondPlatform(Platform platformOne, Platform platformTwo) { // If either platform is ANY, this means this request should match if (platformOne == Platform.ANY || platformTwo == Platform.ANY) { return true; } else if (platformOne != null && platformTwo == null) { // If the first platform is requesting a specific platform, and the 2nd platform is null, // return false for a match as we can't determine if they do in fact match return false; } else if (platformOne == null) { return true; } else { // At the end of the day, we only support basic platforms (Windows or Linux), so group // each platform into the family and compare Platform platformOneFamily = getUnderlyingFamily(platformOne); Platform platformTwoFamily = getUnderlyingFamily(platformTwo); return platformOneFamily == platformTwoFamily; } }
From source file:com.rmn.qa.AutomationUtils.java
License:Open Source License
/** * Returns the underlying 'family' of the specified platform * @param platform//from www . ja va 2s . c om * @return */ public static Platform getUnderlyingFamily(Platform platform) { if (platform == null) { return null; } if (platform == Platform.UNIX || platform == Platform.WINDOWS || platform == Platform.MAC || platform == Platform.ANY) { return platform; } else { return getUnderlyingFamily(platform.family()); } }
From source file:com.rmn.qa.aws.AwsVmManager.java
License:Open Source License
/** * {@inheritDoc}//from ww w . j a v a 2 s . co m */ @Override public List<Instance> launchNodes(final String uuid, Platform platform, final String browser, final String hubHostName, final int nodeCount, final int maxSessions) throws NodesCouldNotBeStartedException { // If platform is null or ANY, go ahead and default to any if (platform == null) { platform = Platform.ANY; } BrowserPlatformPair browserPlatformPair = new BrowserPlatformPair(browser, platform); if (!AutomationUtils.browserAndPlatformSupported(browserPlatformPair)) { throw new RuntimeException("Unsupported browser/platform: " + browserPlatformPair); } // After we have verified the platform is supported, go ahead and set it to the default platform if (platform == platform.ANY) { platform = DEFAULT_PLATFORM; } String userData = getUserData(uuid, hubHostName, browser, platform, maxSessions); Properties awsProperties = getAwsProperties(); String amiId = awsProperties.getProperty(getAmiIdForOs(platform, browser)); String instanceType = awsProperties.getProperty("node_instance_type_" + browser); return this.launchNodes(amiId, instanceType, nodeCount, userData, false); }