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:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/** wait main form Project Configuration when importing project from remote repo */
public void waitOpenProjectConfigForm() {
    new WebDriverWait(seleniumWebDriver, 10).until(ExpectedConditions.visibilityOf(mainForm));
    loader.waitOnClosed();/* w w w . ja v  a 2  s  .c  o  m*/
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/** wait parent directory name on the 'Project Configuration' form */
public void waitParentDirectoryInputOnWizard() {
    new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(parentDirectoryInput));
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/**
 * create a project from existed samples in the wizard widget, type name of project field and
 * click on the create button/*from w w  w  . j  a va  2  s  .co m*/
 *
 * @param projectFromList
 * @param nameProject
 */
public void selectProjectAndCreate(String projectFromList, String nameProject) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(mainForm));
    selectSample(projectFromList);
    typeProjectNameOnWizard(nameProject);
    clickCreateButton();
    waitCloseProjectConfigForm();
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/** wait 'From Archetype:' check box and click it */
public void clickOnFromArchetypeChkBox() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(fromArchetypeChkBox)).click();
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/** wait archetype drop dawn field on the widget */
public void waitArcheTypeDropdawn() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(archetypeDropDown));
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

public void selectArcheTypeFromList(Archetypes type) {
    clickOnFromArchetypeChkBox();//from  w  w  w. j  a v  a 2 s.c o m
    waitArcheTypeDropdawn();
    archetypeDropDown.click();
    WebElement item = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(
                    archetypeDropDown.findElement(By.xpath("//label[text()='" + type.toString() + "']"))));
    item.click();
}

From source file:org.jboss.arquillian.graphene.condition.element.WebElementConditionFactory.java

License:Open Source License

@Override
public ExpectedCondition<Boolean> isVisible() {
    return new BooleanConditionWrapper(ExpectedConditions.visibilityOf(element), getNegation(),
            NoSuchElementException.class);
}

From source file:org.jtalks.tests.jcommune.webdriver.action.Topics.java

License:Open Source License

@Step
public static void editPost(Topic topic, Post postToEdit) {
    openRequiredTopic(topic);/*from  www. j  av a  2s . c  om*/

    postPage.clickEditInPostContainingString(postToEdit.getPostContent());
    try {
        (new WebDriverWait(driver, 40)).until(ExpectedConditions.refreshed(
                ExpectedConditions.presenceOfElementLocated(By.xpath(TopicPage.backButtonOnEditFormSel))));
    } catch (TimeoutException e) {
        info("Edit post method failed by timeout after button [edit] was clicked.");
        throw e;
    }
    String newPostContent = randomAlphanumeric(100);
    topicPage.editPostMessageBody(newPostContent);
    topicPage.clickAnswerToTopicButton();
    for (int i = 0; i < topic.getPosts().size(); i++) {
        if (topic.getPosts().get(i).getPostContent().equals(postToEdit.getPostContent())) {
            topic.getPosts().get(i).setPostContent(newPostContent);
            break;
        }
    }
    (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOf(postPage.getFirstPost()));
}

From source file:org.jtalks.tests.jcommune.webdriver.action.Topics.java

License:Open Source License

/**
 * Looks through several pages of the branch in order to find the topic with the specified title.
 *
 * @param numberOfPagesToCheck since the topic might not be on the first page (either someone simultaneously creates
 *                             a lot of topics, or there are a lot of sticked topics), we have to iteration through
 *                             this number of pages to search for the topic
 * @param topicToFind          a topic title to look for
 * @return true if the specified topic was found
 * @throws CouldNotOpenPageException if specified topic was not found
 */// w  w w .ja  va  2s.  co m
@Step
public static boolean openTopicInCurrentBranch(int numberOfPagesToCheck, String topicToFind)
        throws CouldNotOpenPageException {
    boolean found;
    while (!(found = branchPage.findAndOpenTopic(topicToFind))) {
        info("Topic [" + topicToFind + "] wasn't found on "
                + branchPage.getActiveTopicsButton().get(0).getText() + " page");
        if (!branchPage.openNextPage(numberOfPagesToCheck))
            break;
    }
    if (!found) {
        info("No topic with title [" + topicToFind + "] found");
        throw new CouldNotOpenPageException(topicToFind);
    }
    (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOf(postPage.getTopicTitle()));
    return found;
}

From source file:org.jtalks.tests.jcommune.webdriver.action.Topics.java

License:Open Source License

public static void editCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment) {
    openRequiredTopic(codeReview);//  w ww .j ava2s  .c  o m

    postPage.clickEditInCodeReviewCommentContainingString(codeReviewComment.getPostContent());
    try {
        (new WebDriverWait(driver, 20)).until(ExpectedConditions.refreshed(
                ExpectedConditions.presenceOfElementLocated(By.xpath(PostPage.codeReviewCommentTextFieldSel))));
    } catch (TimeoutException e) {
        info("Edit post method failed by timeout after button [edit] was clicked.");
        throw e;
    }
    String newCommentContent = randomAlphanumeric(100);
    postPage.editCodeReviewCommentBody(newCommentContent);
    postPage.clickOkButtonInEditComment();
    for (int i = 0; i < codeReview.getComments().size(); i++) {
        if (codeReview.getComments().get(i).getPostContent().equals(codeReviewComment.getPostContent())) {
            codeReview.getComments().get(i).setPostContent(newCommentContent);
            break;
        }
    }
    (new WebDriverWait(driver, 20)).until(ExpectedConditions.visibilityOf(postPage.getFirstPost()));
}