List of usage examples for org.openqa.selenium.support.ui ExpectedConditions invisibilityOfElementLocated
public static ExpectedCondition<Boolean> invisibilityOfElementLocated(final By locator)
From source file:org.xframium.page.element.SeleniumElement.java
License:Open Source License
@Override protected boolean _waitFor(long timeOut, TimeUnit timeUnit, WAIT_FOR waitType, String value) { long startTime = System.currentTimeMillis(); if ("V_TEXT".equals(getBy().name().toUpperCase())) { boolean returnValue = Boolean.parseBoolean(PerfectoMobile.instance().imaging() .textExists(getExecutionId(), getDeviceName(), getKey(), (short) timeOut, 50).getStatus()); PageManager.instance().addExecutionLog(getExecutionId(), getDeviceName(), getPageName(), getElementName(), "waitFor", System.currentTimeMillis(), System.currentTimeMillis() - startTime, returnValue ? StepStatus.SUCCESS : StepStatus.FAILURE, getKey(), null, 0, "", false, new String[] { waitType.name().toLowerCase() }); return returnValue; } else {//from w w w .j av a2s.c om try { String currentContext = null; if (webDriver instanceof ContextAware) currentContext = ((ContextAware) webDriver).getContext(); WebDriverWait wait = new WebDriverWait(webDriver, timeOut, 250); WebElement webElement = null; switch (waitType) { case CLICKABLE: webElement = wait.until(ExpectedConditions.elementToBeClickable(useBy())); break; case INVISIBLE: return wait.until(ExpectedConditions.invisibilityOfElementLocated(useBy())); case PRESENT: webElement = wait.until(ExpectedConditions.presenceOfElementLocated(useBy())); break; case SELECTABLE: return wait.until(ExpectedConditions.elementToBeSelected(useBy())); case TEXT_VALUE_PRESENT: return wait.until(ExpectedConditions.textToBePresentInElementValue(useBy(), value)); case VISIBLE: webElement = wait.until(ExpectedConditions.visibilityOfElementLocated(useBy())); break; default: throw new IllegalArgumentException("Unknown Wait Condition [" + waitType + "]"); } if (currentContext != null && webDriver instanceof ContextAware) ((ContextAware) webDriver).context(currentContext); PageManager.instance().addExecutionLog(getExecutionId(), getDeviceName(), getPageName(), getElementName(), "waitFor", System.currentTimeMillis(), System.currentTimeMillis() - startTime, webElement != null ? StepStatus.SUCCESS : StepStatus.FAILURE, getKey(), null, 0, "", webElement instanceof CachedElement, new String[] { waitType.name().toLowerCase() }); return webElement != null; } catch (Exception e) { log.error(Thread.currentThread().getName() + ": Could not locate " + useBy(), e); throw new ObjectIdentificationException(getBy(), useBy()); } } }
From source file:pawl.jbehave.step.BrowserSteps.java
License:Apache License
/** * Verify that HTML element with specified identity does not exist * on the current page .//www. ja va 2 s . c o m * * @param identity element identity for search */ @Then("I get no '$identity' element") @Alias("no '$elementId' element") public void verifyElementIsNotPresent(final String identity) { browser.base().getWait() .until(ExpectedConditions.invisibilityOfElementLocated(browser.base().parseBy(identity))); }
From source file:Search.Dashboard.java
public void pleaseWaitForPageLoad() { new WebDriverWait(driver, timeoutInSeconds) .until(ExpectedConditions.invisibilityOfElementLocated(By.id("divloading"))); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public void waitForElementInvisible(final By by) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME); wait.until(ExpectedConditions.invisibilityOfElementLocated(by)); }
From source file:test.nov21.configuration.AbstractPage.java
License:Open Source License
public void waitForElementToDissappear(final By byLocator) { Wait<WebDriver> wait = new WebDriverWait(getDriver(), DRIVER_WAIT_TIME, 100); wait.until(ExpectedConditions.invisibilityOfElementLocated(byLocator)); }
From source file:test.util.Helpers.java
License:Apache License
/** * Wait 60 seconds for locator to not find a visible element *///from www . j a v a 2s . c o m public static boolean waitInvisible(By locator) { return driverWait.until(ExpectedConditions.invisibilityOfElementLocated(locator)); }
From source file:uk.ac.ebi.atlas.acceptance.selenium.pages.BioEntityPage.java
License:Apache License
public void clickInfoCard(boolean expectToOpen) { infoPaneHeader.click();/* w w w .j a v a 2 s. com*/ if (!expectToOpen) { By infoCardBodyId = By.id("infoBody"); WebDriverWait wait = new WebDriverWait(driver, 10L); wait.until(ExpectedConditions.invisibilityOfElementLocated(infoCardBodyId)); } }
From source file:utils.WebDriverUtils.java
public static void waitForElementToDisappear(WebDriver webDriver, String xpath, long timeout) { System.out.println("Waiting for " + xpath + " element to disappear"); WebDriverWait wait = new WebDriverWait(webDriver, timeout); try {/*from w w w . j a v a2 s. c om*/ wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(xpath))); } catch (TimeoutException e) { AbstractTest.failTest("Element: " + xpath + "<div>Did not disappear after: " + timeout + " s</div>"); } }