Example usage for org.openqa.selenium.support.ui WebDriverWait WebDriverWait

List of usage examples for org.openqa.selenium.support.ui WebDriverWait WebDriverWait

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui WebDriverWait WebDriverWait.

Prototype

public WebDriverWait(WebDriver driver, Duration timeout) 

Source Link

Document

Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others.

Usage

From source file:com.codenvy.corp.MainPage.java

License:Open Source License

public void gotoManageViewAndGoToIdeBornDown() throws IOException, InterruptedException {
    driver.get(String.format(mangeViewUrlIDE, agileIdIDE));
    new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(burnDownMAinContainer));
    burnDownNameIDE = new WebDriverWait(driver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("ghx-items-trigger"))).getText();
    Thread.sleep(10000);//from  w  ww.j ava2 s  .com
    File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    Point p = burnDownMAinContainer.getLocation();

    int width = burnDownMAinContainer.getSize().getWidth();
    int height = burnDownMAinContainer.getSize().getHeight();

    BufferedImage img = ImageIO.read(screen);

    BufferedImage dest = img.getSubimage(p.getX(), p.getY() - 50, width, height);

    ImageIO.write(dest, "png", screen);
    File file = new File(burnDownNameIDE + ".png");
    FileUtils.copyFile(screen, file);
    addText(file, burnDownNameIDE);
}

From source file:com.codenvy.corp.MainPage.java

License:Open Source License

public void gotoManageViewAndGrabCLDIDEBornDown() throws IOException, InterruptedException {
    driver.get(String.format(mangeViewUrlCLDIDE, agileIdPLF));
    new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(burnDownMAinContainer));
    burnDownNamePlf = new WebDriverWait(driver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("ghx-items-trigger"))).getText();
    Thread.sleep(10000);/*from   w  ww .ja v a2  s  .  c  o  m*/
    File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    Point p = burnDownMAinContainer.getLocation();
    int width = burnDownMAinContainer.getSize().getWidth();
    int height = burnDownMAinContainer.getSize().getHeight();
    BufferedImage img = ImageIO.read(screen);
    BufferedImage dest = img.getSubimage(p.getX(), p.getY() - 50, width, height);
    ImageIO.write(dest, "png", screen);
    File file = new File(burnDownNamePlf + ".png");
    FileUtils.copyFile(screen, file);
    addText(file, burnDownNamePlf);

}

From source file:com.codenvy.corp.MainPage.java

License:Open Source License

private void initId() {
    String idAttrIDE = new WebDriverWait(driver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.rapidIdForIDE)))
            .getAttribute("id");
    String idAttrPLF = new WebDriverWait(driver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.rapidIdForPLF)))
            .getAttribute("id");
    agileIdIDE = Integer.parseInt(idAttrIDE.replace("rapidb_lnk_", "").replace("_lnk", ""));
    agileIdPLF = Integer.parseInt(idAttrPLF.replace("rapidb_lnk_", "").replace("_lnk", ""));
}

From source file:com.codenvy.ide.pageObjects.ImportProxyObjects.java

License:Open Source License

/**
 * Selects the import proxy option//from  w  w  w  .j  a  v a  2  s. c o  m
 * @throws Exception
 */
public void selectImportProxyOption() throws Exception {

    try {
        importProxyOption.click();

    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(importProxyOption));

    } catch (Exception e) {
        throw (e);
    }

}

From source file:com.codenvy.ide.pageObjects.ImportProxyObjects.java

License:Open Source License

/**
 * Insert details when importing the proxy
 * /*from  w w  w . j a  v a  2s  .  c  om*/
 * @param fileName  proxy file
 * @param proxyLocation  save location
 * @throws Exception
 */
public void insertImportProxyDetails(String fileName, String proxyLocation) throws Exception {
    try {
        proxyFileElement.sendKeys(fileName);
        proxyLocationElement.sendKeys(proxyLocation);
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.textToBePresentInElement(proxyFileElement, fileName));
        wait.until(ExpectedConditions.textToBePresentInElement(proxyLocationElement, proxyLocation));
    } catch (NoSuchElementException e) {
        log.error("Proxy Import field element not found", e);
    } catch (Exception e) {
        throw (e);
    }
}

From source file:com.codenvy.ide.pageObjects.ImportProxyObjects.java

License:Open Source License

/**
 * Performs the button action/* w  ww .ja va  2 s. com*/
 * @throws Exception
 */
public void fishButtonAction() throws Exception {

    try {
        finishButtonElement.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(finishButtonElement));

    } catch (NoSuchElementException e) {
        log.error("Button element is not available", e);
    } catch (Exception e) {
        throw (e);
    }
}

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Select the new proxy option//from ww w  .  j av  a  2  s  .c  o m
 * @throws Exception
 */
public void selectNewProxyOption() throws Exception {

    try {
        newProxyOption.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(newProxyOption));
    } /*catch (Exception e) {
       log.error("",e);
       //throw (e);
      }*/

}

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Insert details when importing the proxy
 * @param proxyName Name of the proxy//from w  w w. j  av  a 2 s.co  m
 * @param proxyType Type of the proxy
 * @param proxyLocation save location
 * @throws Exception
 */
public void insertNewProxyDetails(String proxyName, String proxyType, String proxyLocation) throws Exception {
    try {
        proxyNameElement.sendKeys(proxyName);
        Select droplist = new Select(proxyTypeElement);
        droplist.selectByVisibleText(proxyType);
        proxyLocationElement.sendKeys(proxyLocation);
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.textToBePresentInElement(proxyNameElement, proxyName));
        wait.until(ExpectedConditions.textToBePresentInElement(proxyTypeElement, proxyName));
        wait.until(ExpectedConditions.textToBePresentInElement(proxyLocationElement, proxyLocation));
    } catch (NoSuchElementException e) {
        log.error("Proxy Creation field element not found", e);
    } /*catch (Exception e) {
       throw (e);
      }*/
}

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Performs the button action//from w w  w .  j a va  2 s .c o m
 * @throws Exception
 */
public void finishButtonAction() throws Exception {
    try {
        finishButtonElement.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(finishButtonElement));
    } catch (NoSuchElementException e) {
        log.error("Button element is not available", e);
    } /*catch (Exception e) {
       throw (e);
      }*/
}

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Performs the list box action//  w w w.j a v  a  2 s  .  c o  m
 * @param proxyType Type of the proxy
 * @throws Exception
 */
public void checkListBoxAction(String proxyType) throws Exception {
    try {
        Select droplist = new Select(proxyTypeElement);
        droplist.selectByVisibleText(proxyType);
        proxyTypeElement.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(proxyTypeElement));
    } catch (NoSuchElementException e) {
        log.error("List Box element is not available", e);
    } /*catch (Exception e) {
       throw (e);
      }*/
}