Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriver.findElement()


public class Selenium2Test extends TestCase {
    public void testFoo() throws Exception {
        WebDriver wd = new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.firefox());
        try {
            wd.get("http://www.yahoo.com/");
            wd.findElement(By.name("p")).sendKeys("hello world");
            wd.findElement(By.id("search-submit")).click();
//        wd.waitForPageToLoad("10000");

            assertTrue(wd.getTitle().contains("hello world"));
            assertTrue(wd.getTitle().contains("Yahoo"));
View Full Code Here


    public void testFoo() throws Exception {
        WebDriver wd = new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.firefox());
        try {
            wd.get("http://www.yahoo.com/");
            wd.findElement(By.name("p")).sendKeys("hello world");
            wd.findElement(By.id("search-submit")).click();
//        wd.waitForPageToLoad("10000");

            assertTrue(wd.getTitle().contains("hello world"));
            assertTrue(wd.getTitle().contains("Yahoo"));
        } finally {
View Full Code Here

        openTestURL();

        WebDriver driver = getDriver();

        WebElement ui = driver.findElement(By.className("v-ui"));

        testBenchElement(ui).scroll(SCROLLTOP);

        driver.findElement(By.id("visibility-toggle"))
                .findElement(By.tagName("input")).click();
View Full Code Here

        WebElement ui = driver.findElement(By.className("v-ui"));

        testBenchElement(ui).scroll(SCROLLTOP);

        driver.findElement(By.id("visibility-toggle"))
                .findElement(By.tagName("input")).click();

        assertEquals("UI scroll position", String.valueOf(SCROLLTOP),
                ui.getAttribute("scrollTop"));
    }
View Full Code Here

      // GIVEN a browser with cookies enabled
      WebDriver driver = createBrowserAndLoadPage(true);
      assertThat(driver.getPageSource(), Matchers.not(Matchers.containsString("jsessionid")));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:standardOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be no jsessionid in the URL
View Full Code Here

      // GIVEN a browser with cookies enabled
      WebDriver driver = createBrowserAndLoadPage(true);
      assertThat(driver.getPageSource(), Matchers.not(Matchers.containsString("jsessionid")));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:navigateOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be no jsessionid in the URL
View Full Code Here

      // GIVEN a browser with cookies disabled
      WebDriver driver = createBrowserAndLoadPage(false);
      assertThat(driver.getPageSource(), Matchers.containsString("jsessionid"));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:standardOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be a jsessionid in the URL
View Full Code Here

      // GIVEN a browser with cookies disabled
      WebDriver driver = createBrowserAndLoadPage(false);
      assertThat(driver.getPageSource(), Matchers.containsString("jsessionid"));

      // WHEN a JSF action redirects with a standard outcome
      driver.findElement(By.id("form:navigateOutcome")).click();

      // THEN the browser should be redirected
      assertThat(driver.getCurrentUrl(), Matchers.containsString("redirected=true"));

      // AND there should be a jsessionid in the URL
View Full Code Here

        WebDriver driver = null;
        try {
            driver = new HtmlUnitDriver();
            driver.navigate().to(url);

            WebElement form = driver.findElement(By.id("oauth_form"));
            WebElement userField = form.findElement(By.id("username_or_email"));
            WebElement passwordField = form.findElement(By.id("password"));

            WebElement submit = form.findElement(By.id("allow"));
View Full Code Here

    public void testNoError() {
        setAuthType(AuthType.NONE,true);
      ResultPage p = launchSnippet("Authentication_Authentication_Summary");
       
        WebDriver webDriver = p.getWebDriver();
    webDriver.findElement(By.id("logoutsmartcloudOA2"));
        webDriver.findElement(By.id("loginsmartcloudOA2"));
        webDriver.findElement(By.id("logoutconnections"));
        webDriver.findElement(By.id("loginconnections"));
        webDriver.findElement(By.id("logoutconnectionsOA2"));
        webDriver.findElement(By.id("loginconnectionsOA2"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.