Examples of WebElement


Examples of org.openqa.selenium.WebElement

    public void go(String url) {
        get(url);
    }

    public void pressNewAccountButton() {
        final WebElement newAccountButton = findElement(By.id("createNewAccountButton"));
        newAccountButton.click();
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

    public WebElement getEmptyPageBox() {
        return findElement(By.id("emptyPageMessageWrapper"));
    }

    public void login(String username, String password) {
        final WebElement loginForm = getLoginForm();
        loginForm.findElement(By.id("usernameField")).sendKeys(username);
        loginForm.findElement(By.id("passwordField")).sendKeys(password);
        loginForm.submit();
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        loginForm.findElement(By.id("passwordField")).sendKeys(password);
        loginForm.submit();
    }

    public void openIdLogin(String openIdUrl) {
        final WebElement openIdLogin = getOpenIdLoginForm();
        openIdLogin.findElement(By.id("openid_identifier")).sendKeys(openIdUrl);
        openIdLogin.submit();
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        openIdLogin.findElement(By.id("openid_identifier")).sendKeys(openIdUrl);
        openIdLogin.submit();
    }

    public void logout() {
        final WebElement logoutLink = findElement(By.linkText("Logout"));
        logoutLink.click();
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

   
    //Click the ("Image Statistics") button to load an AJAX page
    driver.findElement(By.cssSelector("a[title=\"Image Statistics\"] > img")).click();

    //Wait for an AJAX Element ("Summed Images Impressions by Region")
    WebElement summed_img = WaitTool.waitForElement(driver, By.xpath("//div[@id='statistics']/img[3]"), 5);

    //Wait for an AJAX Element ("Directories Visits")
    WebElement directory_img = WaitTool.waitForElement(driver, By.xpath("//div[@id='statistics']/img[5]"),5 );
   
    if(summed_img != null && directory_img != null){     
      // compare with expected values with the actual values
      assertEquals("Image width" , 400, summed_img.getSize().width)
      assertEquals("Image height" , 250, summed_img.getSize().height)
 
      System.out.println("Summed image size: " + summed_img.getSize());
     
      assertEquals("Image width" , 800, directory_img.getSize().width)
      assertEquals("Image height" , 250, directory_img.getSize().height)
 
      System.out.println("directory image size: " + directory_img.getSize());
    }else{
      Assert.fail("Verify Failed: fail for waiting AJAX elements");
    }
   
      }
View Full Code Here

Examples of org.openqa.selenium.WebElement

        assertTrue(waitForTitle(getDriver(), "^File Upload[\\s\\S]*$"));

        getDriver().findElement(By.name("name")).clear();
        getDriver().findElement(By.name("name")).sendKeys("File");
        // getDriver().findElement(By.name("file")).clear();
        final WebElement fileinput = getDriver().findElement(By.name("file"));
        fileinput.sendKeys(new File("pom.xml").getAbsolutePath());
        getDriver().findElement(By.cssSelector("button.btn.btn-primary")).click();
        assertTrue(waitForElement(By.cssSelector("div.alert-success")));
    }
View Full Code Here

Examples of org.openqa.selenium.WebElement

      driverWithReporting = new EventFiringWebDriver(driver);
      driverWithReporting.register(loggingListener);
    }

    driverWithReporting.get("http://www.google.com");
    WebElement element = driverWithReporting.findElement(By.name("q"));
    element.sendKeys("Mifos");
    element.submit();
   
        (new WebDriverWait(driverWithReporting, 10))
          .until(ExpectedConditions.presenceOfElementLocated(By.id("bfoot")));
       
        driverWithReporting.quit();
View Full Code Here

Examples of org.openqa.selenium.WebElement

    * @param int  The time in seconds to wait until returning a failure
    *
    * @return WebElement  the first WebElement using the given method, or null (if the timeout is reached)
    */
  public static WebElement waitForElement(WebDriver driver, final By by, int timeOutInSeconds) {
    WebElement element;
    try
      //To use WebDriverWait(), we would have to nullify implicitlyWait().
      //Because implicitlyWait time also set "driver.findElement()" wait time. 
      //info from: https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/6VO_7IXylgY
      driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); //nullify implicitlyWait()
View Full Code Here

Examples of org.openqa.selenium.WebElement

    * @param int  The time in seconds to wait until returning a failure
    *
    * @return WebElement  the first WebElement using the given method, or null (if the timeout is reached)
    */
  public static WebElement waitForElementPresent(WebDriver driver, final By by, int timeOutInSeconds) {
    WebElement element;
    try{
      driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); //nullify implicitlyWait()
     
      WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
      element = wait.until(ExpectedConditions.presenceOfElementLocated(by));
View Full Code Here

Examples of org.openqa.selenium.WebElement

    *
    * @author Mark Collin
    */
   public static WebElement waitForElementRefresh(WebDriver driver, final By by,
                                 int timeOutInSeconds) {
    WebElement element;
    try
      driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); //nullify implicitlyWait()
            new WebDriverWait(driver, timeOutInSeconds) {
            }.until(new ExpectedCondition<Boolean>() {

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.