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:com.cognifide.qa.bb.aem.ui.wcm.windows.PastePageWindow.java

License:Apache License

/**
 * Waits for the confirmation button of this dialog to be visible and clicks it.
 *//*  w  w w.  ja v a  2  s .  c om*/
@Override
public void confirm() {
    bobcatWait.withTimeout(Timeouts.BIG).until(ExpectedConditions.visibilityOf(copyButton));
    bobcatWait.withTimeout(Timeouts.BIG).until(WindowActions.clickButton(copyButton));
}

From source file:com.cognifide.qa.bb.aem.ui.wcm.windows.PastePageWindow.java

License:Apache License

/**
 * Waits for the cancel button of this dialog to be visible and clicks it.
 *//*from  w w w . j av a  2s.co  m*/
@Override
public void cancel() {
    bobcatWait.withTimeout(Timeouts.BIG).until(ExpectedConditions.visibilityOf(cancelButton));
    bobcatWait.withTimeout(Timeouts.BIG).until(WindowActions.clickButton(cancelButton));
}

From source file:com.cognifide.qa.bb.aem.ui.wcm.windows.SiteAdminConfirmationWindow.java

License:Apache License

/**
 * Waits for the window to be displayed.
 *
 * @return This SiteAdminConfirmationWindow
 *//* w ww  .  ja v  a  2  s .c  o  m*/
public SiteAdminConfirmationWindow waitToBeDisplayed() {
    bobcatWait.withTimeout(Timeouts.BIG).until(ExpectedConditions.visibilityOf(currentScope));
    return this;
}

From source file:com.comcast.dawg.house.ContextMenu.java

License:Apache License

/**
 * Clicks the Edit menu item and then waits for the Edit Overlay to be visible
 * @return//from  w w w .j a  v  a  2s  .co m
 */
public EditDeviceOverlay launchEditDeviceOverlay() {
    clickMenuItem(ContextMenuItem.edit);
    WebDriverWait wait = new WebDriverWait(driver, 20);
    WebElement overlay = driver.findElement(By.className(EDIT_DEVICE_OVERLAY));
    wait.until(ExpectedConditions.visibilityOf(overlay));
    return new EditDeviceOverlay(driver, overlay);
}

From source file:com.consol.citrus.selenium.actions.WaitUntilAction.java

License:Apache License

@Override
protected void execute(WebElement webElement, SeleniumBrowser browser, TestContext context) {
    WebDriverWait q = new WebDriverWait(browser.getWebDriver(), Math.round(timeout / 1000));

    if (condition.equals("hidden")) {
        q.until(ExpectedConditions.invisibilityOf(webElement));
    } else if (condition.equals("visible")) {
        q.until(ExpectedConditions.visibilityOf(webElement));
    } else {/*from  w  w  w .j a v a 2  s. c o m*/
        throw new CitrusRuntimeException("Unknown wait condition");
    }
}

From source file:com.denimgroup.threadfix.selenium.pages.BasePage.java

License:Mozilla Public License

public void waitForElement(WebElement e) {
    WebDriverWait wait = new WebDriverWait(driver, 20);
    wait.until(ExpectedConditions.visibilityOf(e));
}

From source file:com.ecofactor.qa.automation.platform.util.Pageutil.java

License:Open Source License

/**
 * Checks if the sub element displayed.//  w w  w .j av  a  2  s  .  co m
 * @param driver the driver
 * @param subElement the sub element
 * @param locator the locator
 * @param timeout the timeout
 * @return true, if is displayed
 */
public static boolean isDisplayedBySubElement(final WebDriver driver, final WebElement subElement,
        final By locator, final CustomTimeout timeout) {

    boolean displayed = true;
    try {
        final WebDriverWait wait = new WebDriverWait(driver, timeout.getValue());
        wait.until(ExpectedConditions.visibilityOf(subElement.findElement(locator)));
    } catch (Exception te) {
        displayed = false;
    }
    return displayed;
}

From source file:com.gwtplatform.carstore.cucumber.application.BasePage.java

License:Apache License

protected void waitUntilElementIsVisible(WebElement element) {
    webDriverWait().until(ExpectedConditions.visibilityOf(element));
}

From source file:com.hack23.cia.systemintegrationtest.UserPageVisit.java

License:Apache License

/**
 * Perform click action./*from   w w  w .j  av a  2  s.c o  m*/
 *
 * @param clickElement
 *            the click element
 * @param waitDelay
 *            the wait delay
 * @throws InterruptedException
 *             the interrupted exception
 */
private void performClickAction(final WebElement clickElement, final int waitDelay)
        throws InterruptedException {
    assertNotNull(clickElement);
    waitUntilDisplayed(clickElement);

    if (browser.contains("htmlunit")) {
        clickElement.click();
    } else {

        final WebDriverWait wait = new WebDriverWait(driver, WAIT_FOR_PAGE_ELEMENT);
        wait.until(ExpectedConditions.visibilityOf(clickElement));

        action.clickAndHold(clickElement).release().perform();

        //         action.moveToElement(clickElement);
        //         //action.doubleClick(clickElement);

        //         ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", clickElement);
        //         JavascriptExecutor js = (JavascriptExecutor) driver;
        //         js.executeScript("arguments[0].click();", clickElement);

    }
    waitForBrowser(waitDelay);
    grabScreenshot(driver);

}

From source file:com.hotwire.selenium.desktop.us.billing.AbstractBillingPage.java

License:Open Source License

public void submitPanel(WebElement panelContinueBtn) {

    try {//from  www . j  ava 2s.co  m
        LOGGER.info(priceHasChanged.getText() + "\n");
    } catch (NoSuchElementException e) {
        // no action
    }

    //grab the panel container that contains the button for checks later
    WebElement panel = panelContinueBtn
            .findElement(By.xpath("./ancestor::*[contains(@class, 'yui-accordion-content')]"));
    new WebDriverWait(getWebDriver(), VISIBLE_WAIT).until(ExpectedConditions.visibilityOf(panelContinueBtn));
    panelContinueBtn.click();
}