Example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOf

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOf

Introduction

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

Prototype

public static ExpectedCondition<WebElement> visibilityOf(final WebElement element) 

Source Link

Document

An expectation for checking that an element, known to be present on the DOM of a page, is visible.

Usage

From source file:ru.devprom.pages.kanban.KanbanBuildsPage.java

public void clickRealized() {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(moreBtn));
    moreBtn.click();//w w w  .ja v a  2 s  .  co m
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(realizedItem));
    realizedItem.click();
}

From source file:ru.devprom.pages.kanban.KanbanEnvirenmentNewPage.java

public void createEnvironment(String name, String adress, String description) {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(nameField));
    nameField.clear();/*w ww  .j  a  v a2 s  .c  o  m*/
    nameField.sendKeys(name);
    addresField.clear();
    addresField.sendKeys(adress);
    descriptionField.clear();
    descriptionField.sendKeys(description);
    submitDialog(saveBtn);
}

From source file:ru.devprom.pages.kanban.KanbanEnvirenmentsPage.java

public KanbanEnvirenmentNewPage clickAddEnvironment() {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(addEnvirenment));
    addEnvirenment.click();/*from ww w.  ja  va 2s .  c  om*/
    return new KanbanEnvirenmentNewPage(driver);
}

From source file:ru.devprom.pages.kanban.KanbanNewBuildPage.java

public void createNewBuild(String name, String description, String commitNumber) {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(saveBtn));
    numberField.clear();//from  ww w . j  a  v  a 2s.c  o m
    numberField.sendKeys(name);
    if (!commitNumber.equals("")) {
        commitNumberField.sendKeys(commitNumber);
        autocompleteSelect(commitNumber);
    }
    if (!description.equals("")) {
        (new CKEditor(driver)).typeText(description);
    }
    submitDialog(saveBtn);
    FILELOG.debug("Created new build " + name);
}

From source file:ru.devprom.pages.kanban.KanbanNewBuildPage.java

public void createSimpleNewBuild(String name) {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(saveBtn));
    numberField.clear();//from  ww w . j  av a 2 s  . c om
    numberField.sendKeys(name);
    submitDialog(saveBtn);
    FILELOG.debug("Created new build " + name);
}

From source file:ru.devprom.pages.project.requirements.RequirementsDocsPage.java

public RequirementViewPage addDoc() {
    (new WebDriverWait(driver, waiting)).until(ExpectedConditions.visibilityOf(addDocBtn));
    addDocBtn.click();/*from  ww  w.j  a  v a  2s.co m*/
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    }
    return new RequirementViewPage(driver);
}

From source file:ru.devprom.pages.scrum.ScrumIssueViewPage.java

public FunctionNewPage convertToEpic() {
    actionsBtn.click();//from ww w  .j av a  2  s.c  om
    (new WebDriverWait(driver, 5)).until(ExpectedConditions.visibilityOf(convertToEpic));
    convertToEpic.click();
    return new FunctionNewPage(driver);
}

From source file:selenium_tumblr_test.BasePage.java

License:Open Source License

public void waitForElementToBeVisible(By elementBy, int seconds) {
    WebElement element = (new WebDriverWait(driver, seconds))
            .until(ExpectedConditions.visibilityOf(driver.findElement(elementBy)));
}

From source file:swift.selenium.CommonExpectedConditions.java

License:Open Source License

/**
 * An Expectation for checking an element is visible and enabled such that you
 * can click it.//from  ww w .j  a v a2s  .  com
 * 
 * @param GivenElement element to be checked
 * @author Michal Nowierski
 */
public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement GivenElement) {
    return new ExpectedCondition<WebElement>() {

        public ExpectedCondition<WebElement> visibilityOfElement = ExpectedConditions
                .visibilityOf(GivenElement);

        public WebElement apply(WebDriver driver) {
            WebElement element = visibilityOfElement.apply(driver);
            try {
                if (element != null && element.isEnabled()) {
                    return element;
                } else {
                    return null;
                }
            } catch (StaleElementReferenceException e) {
                return null;
            }
        }

        @Override
        public String toString() {
            return "element to be clickable: " + GivenElement.getTagName();
        }
    };
}

From source file:swift.selenium.CommonExpectedConditions.java

License:Open Source License

/**
 * An Expectation for checking an element is visible and not enabled such that you
 * can not click it./*from   w  ww  .  j  a v  a 2s  .c  om*/
 * 
 * @param GivenElement element to be checked
 * @author Michal Nowierski
 */
public static ExpectedCondition<WebElement> elementNotToBeClickable(final WebElement GivenElement) {
    return new ExpectedCondition<WebElement>() {

        public ExpectedCondition<WebElement> visibilityOfElement = ExpectedConditions
                .visibilityOf(GivenElement);

        public WebElement apply(WebDriver driver) {
            WebElement element = visibilityOfElement.apply(driver);
            try {
                if (element != null && !element.isEnabled()) {
                    return element;
                } else {
                    return null;
                }
            } catch (StaleElementReferenceException e) {
                return null;
            }
        }

        @Override
        public String toString() {
            return "element to be clickable: " + GivenElement.getTagName();
        }
    };
}