List of usage examples for org.openqa.selenium.support.ui ExpectedConditions invisibilityOfElementLocated
public static ExpectedCondition<Boolean> invisibilityOfElementLocated(final By locator)
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Cancel Editor Button.//w w w . j ava 2 s .c om * * @throws Exception Exception */ @Test public void testAddWorkflow30() throws Exception { // given // when clickAddNewWorkflow(); click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-close-button")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("form-modal"))); // when click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-cancel-button")); // then assertEquals(getDefaultHostAndPort() + "/user/dashboard/index", getCurrentUrl()); }
From source file:com.fpt.datht.iap.AutoIAP.java
public static void autoCheck() { for (int c = 1; c < count; c++) { driver.get(slots[c]);/*from w ww. j a v a2s .com*/ try { new WebDriverWait(driver, 5) .until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//input[@type='submit']"))); } catch (TimeoutException ex) { driver.get(slots[c].replaceAll("add.php", "edit.php")); } new WebDriverWait(driver, 10) .until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//input[@type='submit']"))); for (Student st : students) { List<WebElement> els = driver.findElements(By.name(st.name)); els.stream().filter((e) -> (e.getAttribute("value").equals("1"))).forEach((e) -> { e.click(); }); } el = driver.findElement(By.xpath(".//input[@type='submit']")); el.click(); try { new WebDriverWait(driver, 3).until( ExpectedConditions.invisibilityOfElementLocated(By.xpath(".//input[@type='submit']"))); } catch (TimeoutException ex) { break; } } }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Wait until element is vanished.//w w w. j a v a 2 s . c o m * * @param timeoutSec - the maximum time to wait in seconds (until element become invisible or disappeared) * @param checkCondition log assert for expected conditions. * @return Parent instance */ public ParentPanel waitForElementToVanish(int timeoutSec, boolean checkCondition) { boolean isVanished; logAction(this, getParentClassName(), format("waitForElementToVanish: %s", locator)); long start = System.currentTimeMillis() / 1000; WebDriverWait wait = (WebDriverWait) new WebDriverWait(getDriver(), timeoutSec) .ignoring(StaleElementReferenceException.class, NoSuchElementException.class); setTimeout(1); try { isVanished = wait.until(ExpectedConditions.invisibilityOfElementLocated(avatar.byLocator)); } catch (TimeoutException e) { logTechnical(format("waitForElementToVanish: [ %s ] during: [ %d ] sec ", locator, System.currentTimeMillis() / 1000 - start)); isVanished = false; } setTimeout(TIMEOUT); if (checkCondition) { logAssertTrue(BUSINESS_LEVEL, isVanished, format("waitForElementToVanish - '%s' should be vanished", getName()), takePassedScreenshot); } return parent; }
From source file:com.ggasoftware.uitest.utils.WebDriverWrapper.java
License:Open Source License
/** * Wait until link not presents at web page. * * @param linkText - linkText to not be presents. * @param timeoutSec to wait until not presents. * @param checkCondition log assert for expected conditions. *//*from w w w . ja v a 2 s.com*/ public static void waitForLinkToNotBePresent(String linkText, int timeoutSec, boolean checkCondition) { ReporterNGExt.logAction(getDriver(), "", String.format("waitForLinkToNotBePresent: %s", linkText)); boolean isNotPresent; long start = System.currentTimeMillis() / 1000; WebDriverWait wait = (WebDriverWait) new WebDriverWait(getDriver(), timeoutSec) .ignoring(StaleElementReferenceException.class); setTimeout(timeoutSec); try { isNotPresent = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.linkText(linkText))); } catch (TimeoutException ignored) { ReporterNGExt.logTechnical(String.format("waitForLinkToNotBePresent: [ %s ] during: [ %d ] sec ", linkText, System.currentTimeMillis() / 1000 - start)); isNotPresent = false; } setTimeout(TIMEOUT); if (checkCondition) { ReporterNGExt.logAssertTrue(ReporterNGExt.BUSINESS_LEVEL, isNotPresent, String.format("waitForLinkToNotBePresent: link with text '%s' should not be exists", linkText), TestBaseWebDriver.takePassedScreenshot); } }
From source file:com.hotwire.selenium.bex.BexAbstractPage.java
License:Open Source License
protected void waitProgressBar() { new WebDriverWait(getWebDriver(), MAX_WAIT) .until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(getProgressBar()))); }
From source file:com.hotwire.selenium.bex.BexAbstractPage.java
License:Open Source License
protected void waitUntilDisappear(String css, int wait) { new WebDriverWait(getWebDriver(), wait) .until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(css))); }
From source file:com.hotwire.selenium.desktop.helpCenter.HelpCenterAbstractPage.java
License:Open Source License
protected void waitUntilDisappear(String css) { new WebDriverWait(getWebDriver(), DEFAULT_WAIT) .until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(css))); }
From source file:com.hotwire.selenium.desktop.us.billing.onepage.HotelTripInsuranceFragment.java
License:Open Source License
@Override public AdditionalFeatures withInsurance(boolean wantTripInsurance) { // Wait for the updating layer to disappear new WebDriverWait(getWebDriver(), 15) .until(ExpectedConditions.invisibilityOfElementLocated(By.className("loadingImage"))); // Get current state of payment method fragment selection. String selectedIDValue = new HotelBillingOnePage(getWebDriver()).getSelectedPaymentMethodIDValue(); logger.info("Current selected payment method ID: " + selectedIDValue); try {//w w w . ja va 2 s . c om if (wantTripInsurance) { logger.info("Select insurance: YES"); yesRadioButton.click(); } else { logger.info("Select insurance: NO"); noRadioButton.click(); } // Wait until Ajax is silent new Wait<Boolean>(new IsAjaxDone()).maxWait(30).apply(getWebDriver()); // Check if selected payment has changed. String current = new HotelBillingOnePage(getWebDriver()).getSelectedPaymentMethodIDValue(); logger.info( "Before selecting insurance: " + selectedIDValue + " - After selecting insurance: " + current); if (!current.equals(selectedIDValue)) { logger.info("Reselecting payment type due to insurance selection."); getWebDriver().findElement(By.id(selectedIDValue)).click(); } new HotelBillingOnePage(getWebDriver()); } catch (NoSuchElementException e) { logger.warn("Travel Insurance panel didn't load"); } return this; }
From source file:com.hotwire.selenium.desktop.us.billing.onepage.HotelVmeFragment.java
License:Open Source License
public void fillVmePaymentMethodPanel(String username, String password) { // Choose Vme as payment method this.vmePaymentTypeRadioButton.click(); // Click the Vme buy button to launch the lightbox this.vmeBuyButton.click(); // Switch to the lightbox iframe getWebDriver().switchTo().frame(this.vmeIframe); new WebDriverWait(getWebDriver(), DEFAULT_WAIT) .until(PageObjectUtils.webElementVisibleTestFunction(By.id(USERNAME_ID), true)); getWebDriver().findElement(By.id(USERNAME_ID)).clear(); getWebDriver().findElement(By.id(USERNAME_ID)).sendKeys(username); getWebDriver().findElement(By.id(PASSWORD_ID)).clear(); getWebDriver().findElement(By.id(PASSWORD_ID)).sendKeys(password); getWebDriver().findElement(By.cssSelector(SIGN_IN_BUTTON_ID)).click(); // We assume sign in was successful here... // Switch to the main billing window getWebDriver().switchTo().defaultContent(); // Switch to the lightbox iframe getWebDriver().switchTo().frame(this.vmeIframe); WebDriverWait wait = new WebDriverWait(getWebDriver(), DEFAULT_WAIT); wait.until(ExpectedConditions.elementToBeClickable(By.xpath(CONTINUE_BUTTON_XPATH))).click(); // Done interacting with lightbox, switch back to main billing window getWebDriver().switchTo().defaultContent(); // Wait for the lightbox to go away wait = new WebDriverWait(getWebDriver(), DEFAULT_WAIT); wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(LIGHTBOX_IFRAME_XPATH))); }
From source file:com.hotwire.selenium.desktop.us.results.hotel.fragments.filters.HotelResultsFilteringTabsFragment.java
License:Open Source License
public void clickResetFilters() { resetFilters.click();//from w ww . j ava 2 s . co m By locator = By.cssSelector("div[id='updatingLayer'] .loadingMask"); new WebDriverWait(getWebDriver(), 3).until(ExpectedConditions.invisibilityOfElementLocated(locator)); }