List of usage examples for org.openqa.selenium.firefox FirefoxDriver BINARY
String BINARY
To view the source code for org.openqa.selenium.firefox FirefoxDriver BINARY.
Click Source Link
From source file:org.openqa.grid.e2e.node.DefaultProxyInjectsConfigurationUuidTest.java
License:Apache License
@Before public void prepare() throws Exception { hub = GridTestHelper.getHub();//from w ww.j a v a2 s . c o m registry = hub.getRegistry(); registry.setThrowOnCapabilityNotPresent(false); remote = GridTestHelper.getRemoteWithoutCapabilities(hub.getUrl(), GridRole.NODE); remote.setMaxConcurrent(100); ff20_caps = DesiredCapabilities.firefox(); ff20_caps.setCapability(FirefoxDriver.BINARY, "should be overwritten"); ff20_caps.setVersion("20"); remote.addBrowser(ff20_caps, 1); remote.setRemoteServer(new SeleniumServer(remote.getConfiguration())); remote.startRemoteServer(); remote.sendRegistrationRequest(); RegistryTestHelper.waitForNode(registry, 1); }
From source file:org.openqa.grid.e2e.node.DefaultProxyInjectsConfigurationUuidTest.java
License:Apache License
@Test(timeout = 5000) public void testProxyInjectsConfigurationUUID() throws MalformedURLException { Map<String, Object> req_caps = new HashMap<>(); req_caps.put(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX); req_caps.put(CapabilityType.VERSION, "20"); req_caps.put(FirefoxDriver.BINARY, "custom"); RequestHandler newSessionRequest = new MockedRequestHandler(getNewRequest(req_caps)); newSessionRequest.process();//from w w w . ja va 2 s . c o m assertEquals(ff20_caps.getCapability(GridNodeConfiguration.CONFIG_UUID_CAPABILITY), newSessionRequest .getSession().getRequestedCapabilities().get(GridNodeConfiguration.CONFIG_UUID_CAPABILITY)); assertEquals("custom", newSessionRequest.getSession().getRequestedCapabilities().get(FirefoxDriver.BINARY)); }
From source file:org.openqa.grid.selenium.proxy.DefaultRemoteProxy.java
License:Apache License
/** * The client shouldn't have to care where firefox is installed as long as the correct version is * launched, however with webdriver the binary location is specified in the desiredCapability, * making it the responsibility of the person running the test. * /* ww w. j a v a2 s . c o m*/ * With this implementation of beforeSession, that problem disappears . If the webdriver slot is * registered with a firefox using a custom binary location, the hub will handle it. * * <p> * For instance if a node registers: * {"browserName":"firefox","version":"7.0","firefox_binary":"/home/ff7"} * * and later on a client requests {"browserName":"firefox","version":"7.0"} , the hub will * automatically append the correct binary path to the desiredCapability before it's forwarded to * the server. That way the version / install location mapping is done only once at the node * level. */ public void beforeSession(TestSession session) { if (session.getSlot().getProtocol() == SeleniumProtocol.WebDriver) { Map<String, Object> cap = session.getRequestedCapabilities(); if ("firefox".equals(cap.get(CapabilityType.BROWSER_NAME))) { if (session.getSlot().getCapabilities().get(FirefoxDriver.BINARY) != null && cap.get(FirefoxDriver.BINARY) == null) { session.getRequestedCapabilities().put(FirefoxDriver.BINARY, session.getSlot().getCapabilities().get(FirefoxDriver.BINARY)); } } } }
From source file:org.openqa.grid.selenium.proxy.WebDriverRemoteProxy.java
License:Apache License
public void beforeSession(TestSession session) { Map<String, Object> cap = session.getRequestedCapabilities(); if ("firefox".equals(cap.get(CapabilityType.BROWSER_NAME))) { if (session.getSlot().getCapabilities().get(FirefoxDriver.BINARY) != null && cap.get(FirefoxDriver.BINARY) == null) { session.getRequestedCapabilities().put(FirefoxDriver.BINARY, session.getSlot().getCapabilities().get(FirefoxDriver.BINARY)); }/* w ww . j a v a 2 s . com*/ } }
From source file:org.qe4j.web.OpenWebDriver.java
License:Open Source License
/** * Builds a remote WebDriver suitable for use on Selenium Grid, configured * by properties./* w ww . j a v a2 s .c o m*/ * * @param browser * @param platform * @param properties * @return RemoteWebDriver * @throws IOException */ protected WebDriver initRemoteWebDriver(Browser browser, String version, Platform platform, Properties properties) throws IOException { // determine browser capabilities DesiredCapabilities capabilities = null; String browserCapabilityKey = null; switch (browser) { case FIREFOX: default: capabilities = DesiredCapabilities.firefox(); FirefoxProfile profile = getFireFoxProfile(); // JavaScriptError.addExtension(profile); // TODO add JSErrorCollector to maven dependency capabilities.setCapability(FirefoxDriver.PROFILE, profile); browserCapabilityKey = FirefoxDriver.BINARY; break; case IEXPLORE: capabilities = DesiredCapabilities.internetExplorer(); /* * TODO determine how to access different version of IE on * remote server */ break; case HTMLUNIT: capabilities = DesiredCapabilities.htmlUnit(); break; case CHROME: capabilities = DesiredCapabilities.chrome(); browserCapabilityKey = "chrome.binary"; initChromeProfile(capabilities); break; } capabilities.setJavascriptEnabled(true); capabilities.setPlatform(platform); capabilities.setBrowserName(browser.toString().toLowerCase()); capabilities.setVersion(version); // determine the browser binary path key by version String browserBinaryPath = getBrowserBinaryPath(platform, browser, version, properties); if (browserBinaryPath != null) { capabilities.setCapability(browserCapabilityKey, browserBinaryPath); } // else use default /* * TODO remote grid system setup for setting IE and Chrome drivers * http://element34.ca/blog/iedriverserver-webdriver-and-python */ /* * TODO add safari support * http://code.google.com/p/selenium/wiki/SafariDriver */ // define a name to appear in SauceLabs for the activity of this driver // TODO investigate making this more configurable int timestamp = (int) (System.currentTimeMillis() / 1000); capabilities.setCapability("name", browser + "-" + version + " on " + platform + " time " + timestamp); // create remote web driver WebDriver remoteDriver = null; gridUrl = properties.getProperty(GRID_URL_PROP_KEY); if (gridUrl != null && !gridUrl.equals("")) { remoteDriver = OpenWebDriver.newRemoteWebDriver(gridUrl, capabilities); } else { // TODO remoteDriver = initSauceWebDriver(properties, capabilities); } return remoteDriver; }