List of usage examples for org.openqa.selenium WebDriver get
void get(String url);
From source file:org.kurento.room.test.RoomTest.java
License:Open Source License
protected void joinToRoom(WebDriver userBrowser, String userName, String roomName) { userBrowser.get(appUrl); findElement(userName, userBrowser, "name").sendKeys(userName); findElement(userName, userBrowser, "roomName").sendKeys(roomName); findElement(userName, userBrowser, "joinBtn").submit(); }
From source file:org.lunifera.example.vaadin.osgi.testpart.TextFieldPartTest.java
License:Apache License
@Test public void test() { WebDriver driver = new FirefoxDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Alternatively the same thing can be done like this // driver.navigate().to("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the // element/*from w w w . j av a 2 s .co m*/ element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); // Should see: "cheese! - Google Search" System.out.println("Page title is: " + driver.getTitle()); // Close the browser driver.quit(); }
From source file:org.me.seleniumGridUI.SeleniumStatus.java
public String getEnvironment() throws Throwable { if (IsThisDeviceTesting()) { return StringUtils.EMPTY; }// w ww . ja v a 2s . c o m Map<String, String> myMap = new HashMap<String, String>(); SeleniumGridOperation seleniumOperation = SeleniumGridOperation.getInstance(); WebDriver driver = new RemoteWebDriver(new URL(hubUrl), seleniumOperation.CreateBrowserCapbility("phantomjs")); driver.get("http://www.autoscout24.de/build.txt"); String siteContent = driver.findElement(By.tagName("pre")).getText(); if (driver != null) { driver.quit(); } String[] elements = siteContent.split("\\n"); for (String s1 : elements) { s1 = s1.replaceAll("\\s", ""); String[] keyValue = s1.split(":"); myMap.put(keyValue[0], keyValue[1]); } return myMap.get("Environment"); }
From source file:org.metawidget.util.ScenarioRunnerTestCase.java
License:LGPL
/** * Run the Scenario Runner by hitting the given URL and waiting until all tests complete. *//*from w w w . j a v a 2 s . c om*/ protected final void runScenarioRunner(String url) { WebDriver driver = new FirefoxDriver(); try { // Hit the url driver.get(url); // Wait for all scenario runner tests to run, and fail on error new WebDriverWait(driver, TEST_TIMEOUT_IN_SECONDS).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver theDriver) { return applyExpectedCondition(theDriver); } }); displayResult(driver); } finally { driver.quit(); } }
From source file:org.mifos.server.wartest.MifosPackagedWARBasicTest.java
License:Open Source License
@Test public void testPackagedWARStartup() throws Exception { WARServerLauncher serverLauncher = mifosLauncher(7077); serverLauncher.startServer();//from w ww. ja v a 2s. co m WebDriver wd = new FirefoxDriver(); wd.get("http://localhost:7077/mifos/"); wd.findElement(By.id("login.input.username")).sendKeys("mifos"); wd.findElement(By.id("login.input.password")).sendKeys("testmifos"); wd.findElement(By.id("login.button.login")).click(); Assert.assertTrue(wd.getPageSource().contains("Mifos")); Assert.assertTrue(wd.getPageSource().contains("Home")); Assert.assertTrue(wd.getPageSource().contains("Search")); wd.quit(); serverLauncher.stopServer(); serverLauncher = null; }
From source file:org.mifos.server.workspace.SeleniumTest.java
License:Open Source License
@Test public void testSearchMifosOnGoogle() throws Exception { WebDriver wd = new FirefoxDriver(); try {/*from w ww . ja va2 s.co m*/ wd.get("http://www.google.com"); WebElement element = wd.findElement(By.name("q")); element.sendKeys("Mifos"); element.submit(); } finally { wd.quit(); } }
From source file:org.mifos.server.workspace.WorkspaceServerLauncherTest.java
License:Open Source License
@Test public void testLogin() throws Exception { WebDriver wd = new FirefoxDriver(); wd.get(getAppURL()); wd.findElement(By.id(UID)).sendKeys("mifos"); wd.findElement(By.id(PWD)).sendKeys("testmifos"); wd.findElement(By.id(BTN)).click();/*from w w w . j a v a 2 s . com*/ Assert.assertTrue(wd.getPageSource().contains("Mifos")); Assert.assertTrue(wd.getPageSource().contains("Home")); Assert.assertTrue(wd.getPageSource().contains("Search")); wd.quit(); }
From source file:org.mitre.mpf.wfm.ui.NodesAndProcessPage.java
License:Open Source License
public List<String> getCurrentNodesAndProcessFromNodeManager(WebDriver driver, String node_mgr_url) { log.info("Checking node manager at {}", node_mgr_url); // load the node manager page driver.get(node_mgr_url); // Wait for the login page to load, timeout after 10 seconds (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return NodesAndProcessPage.ValidNodeManagerPage(d); }/*from w ww. jav a 2 s . com*/ }); log.info("Looking for element meta"); WebElement meta = driver.findElement(By.xpath("//meta")); // meta List<WebElement> rows = driver.findElements(By.xpath("//body/table[1]/tbody/tr"));// first table ArrayList<String> list = new ArrayList<String>(); log.info("Table found with [" + rows.size() + "] rows. Building list. "); for (int rnum = 1; rnum < rows.size(); rnum++) {// skip first (0) since // its the headers List<WebElement> columns = rows.get(rnum).findElements(By.tagName("td")); list.add(columns.get(0).getText() + ":" + columns.get(1).getText() + ":" + columns.get(2).getText());// name:rank:state } return list; }
From source file:org.mousephenotype.cda.selenium.support.GraphPage.java
License:Apache License
/** * Creates a new <code>GraphPage</code> instance * * @param driver <code>WebDriver</code> instance * @param wait <code>WebDriverWait</code> instance * @param graphUrl url of graph page to load * @param baseUrl the base url pointing to the downloads * @throws TestException/*from ww w .j av a2s .com*/ */ public GraphPage(WebDriver driver, WebDriverWait wait, String graphUrl, String baseUrl) throws TestException { this.driver = driver; this.wait = wait; this.graphUrl = graphUrl; this.baseUrl = baseUrl; driver.get(graphUrl); load(); }
From source file:org.mousephenotype.cda.selenium.support.SearchPage.java
License:Apache License
/** * Creates a new <code>SearchPage</code> instance attempting to load the * search web page at <code>target</code>. * @param driver Web driver//from www . ja v a2 s.c o m * @param timeoutInSeconds The <code>WebDriver</code> timeout, in seconds * @param target target search URL * @param baseUrl A fully-qualified hostname and path, such as * http://ves-ebi-d0:8080/mi/impc/dev/phenotype-arcihve * @param map a map of HTML table-related definitions, keyed by <code> * TableComponent</code>. * * @throws TestException If the target cannot be set */ public SearchPage(WebDriver driver, int timeoutInSeconds, String target, String baseUrl, Map<SearchFacetTable.TableComponent, By> map) throws TestException { this.driver = driver; this.timeoutInSeconds = timeoutInSeconds; this.baseUrl = baseUrl; this.map = map; wait = new WebDriverWait(driver, timeoutInSeconds); if ((target != null) && (!target.isEmpty())) { try { driver.get(target); } catch (Exception e) { throw new TestException("EXCEPTION: " + e.getLocalizedMessage() + "\ntarget: '" + target + "'"); } this.target = target; } // Initialise facets map. initialiseFacets(); }