Codota Logo
WebDriverWait.until
Code IndexAdd Codota to your IDE (free)

How to use
until
method
in
org.openqa.selenium.support.ui.WebDriverWait

Best Java code snippets using org.openqa.selenium.support.ui.WebDriverWait.until (Showing top 20 results out of 900)

  • Common ways to obtain WebDriverWait
private void myMethod () {
WebDriverWait w =
  • Codota IconWebDriver driver;new WebDriverWait(driver, timeOutInSeconds)
  • Codota IconWebDriver webDriver;new WebDriverWait(webDriver, long1, long2)
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

 // times out after 5 seconds
WebDriverWait wait = new WebDriverWait(driver, 5);

// while the following loop runs, the DOM changes - 
// page is refreshed, or element is removed and re-added
wait.until(presenceOfElementLocated(By.id("container-element")));        

// now we're good - let's click the element
driver.findElement(By.id("foo")).click();
origin: stackoverflow.com

 WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(
    ExpectedConditions.visibilityOfElementLocated(By.id("someid")));
origin: stackoverflow.com

 WebDriverWait wait = new WebDriverWait(driver, 10);      
Alert alert = wait.until(ExpectedConditions.alertIsPresent());     
alert.authenticateUsing(new UserAndPassword(**username**, **password**));
origin: stackoverflow.com

 public void checkAlert() {
  try {
    WebDriverWait wait = new WebDriverWait(driver, 2);
    wait.until(ExpectedConditions.alertIsPresent());
    Alert alert = driver.switchTo().alert();
    alert.accept();
  } catch (Exception e) {
    //exception handling
  }
}
origin: apache/geode

 private WebElement waitForElementById(final String id, int timeoutInSeconds) {
  WebElement element =
    (new WebDriverWait(driver, timeoutInSeconds, 1000))
      .until((ExpectedCondition<WebElement>) d -> d.findElement(By.id(id)));
  assertNotNull(element);
  return element;
 }
}
origin: apache/geode

private void login() {
 WebElement userNameElement = waitForElementById("user_name", 60);
 WebElement passwordElement = waitForElementById("user_password");
 userNameElement.sendKeys(username);
 passwordElement.sendKeys(password);
 passwordElement.submit();
 driver.get(getPulseURL() + "clusterDetail.html");
 WebElement userNameOnPulsePage =
   (new WebDriverWait(driver, 30, 1000)).until(
     (ExpectedCondition<WebElement>) d -> d.findElement(By.id("userName")));
 assertNotNull(userNameOnPulsePage);
}
origin: testcontainers/testcontainers-java

protected void doSimpleWebdriverTest(BrowserWebDriverContainer rule) {
  RemoteWebDriver driver = setupDriverFromRule(rule);
  System.out.println("Selenium remote URL is: " + rule.getSeleniumAddress());
  System.out.println("VNC URL is: " + rule.getVncAddress());
  driver.get("http://www.google.com");
  WebElement search = driver.findElement(By.name("q"));
  search.sendKeys("testcontainers");
  search.submit();
  List<WebElement> results = new WebDriverWait(driver, 15)
    .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#search h3")));
  assertTrue("the word 'testcontainers' appears in search results",
    results.stream()
      .anyMatch(el -> el.getText().contains("testcontainers")));
}
origin: la-team/light-admin

@Override
public void waitForElementVisible(final WebElement element, long timeout) {
  new WebDriverWait(webDriver, timeout).until(new Predicate<WebDriver>() {
    @Override
    public boolean apply(WebDriver input) {
      return isElementPresent(element);
    }
  });
}
origin: la-team/light-admin

@Override
public void waitForElementInvisible(final WebElement element) {
  new WebDriverWait(webDriver, webDriverTimeout).until(new Predicate<WebDriver>() {
    @Override
    public boolean apply(WebDriver input) {
      return !isElementPresent(element);
    }
  });
}
origin: la-team/light-admin

public static void assertImagePreviewIsDisplayed(String viewName, final WebElement webElement, final ExtendedWebDriver webDriver, final long timeout) {
  try {
    new WebDriverWait(webDriver, timeout).until(new ExpectedCondition<Boolean>() {
      @Override
      public Boolean apply(WebDriver input) {
        return webDriver.isElementPresent(webElement.findElement(By.xpath("//img[@name='picture']")));
      }
    });
  } catch (TimeoutException e) {
    fail("Image preview is not displayed on " + viewName);
  }
}
origin: TEAMMATES/teammates

/**
 * Waits for the page to load. This includes all AJAX requests and Angular animations in the page.
 */
public void waitForPageLoad() {
  WebDriverWait wait = new WebDriverWait(driver, TestProperties.TEST_TIMEOUT);
  ExpectedCondition<Boolean> expectation = driver ->
      "complete".equals(((JavascriptExecutor) driver).executeAsyncScript(PAGE_LOAD_SCRIPT).toString());
  wait.until(expectation);
}
origin: appium/java-client

@Test public void hideKeyboardWithParametersTest() {
  new WebDriverWait(driver, 30)
      .until(ExpectedConditions.presenceOfElementLocated(By.id("IntegerA")))
      .click();
  driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
}
origin: appium/java-client

  @Test
  public void openNotification() {
    driver.closeApp();
    driver.openNotifications();
    WebDriverWait wait = new WebDriverWait(driver, 20);
    assertNotEquals(0, wait.until(input -> {
      List<AndroidElement> result = input
          .findElements(id("com.android.systemui:id/settings_button"));

      return result.isEmpty() ? null : result;
    }).size());
  }
}
origin: appium/java-client

  @Test public void webViewPageTestCase() throws InterruptedException {
    new WebDriverWait(driver, 30)
        .until(ExpectedConditions.presenceOfElementLocated(By.id("login")))
        .click();
    driver.findElementByAccessibilityId("webView").click();
    new WebDriverWait(driver, 30)
        .until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Webview")));
    findAndSwitchToWebView();
    WebElement el = driver.findElementByPartialLinkText("login");
    assertTrue(el.isDisplayed());
  }
}
origin: appium/java-client

  @Test public void getAlertTextTest() {
    driver.findElement(MobileBy.AccessibilityId(iOSAutomationText)).click();
    waiting.until(alertIsPresent());
    assertFalse(StringUtils.isBlank(driver.switchTo().alert().getText()));
  }
}
origin: appium/java-client

@Test public void dismissAlertTest() {
  Supplier<Boolean> dismissAlert = () -> {
    driver.findElement(MobileBy.AccessibilityId(iOSAutomationText)).click();
    waiting.until(alertIsPresent());
    driver.switchTo().alert().dismiss();
    return true;
  };
  assertTrue(dismissAlert.get());
}
origin: appium/java-client

@Test
public void testPortraitUpsideDown() {
  new WebDriverWait(driver, 20).until(ExpectedConditions
      .elementToBeClickable(driver.findElementById("android:id/content")
          .findElement(MobileBy.AccessibilityId("Graphics"))));
  DeviceRotation landscapeRightRotation = new DeviceRotation(0, 0, 180);
  driver.rotate(landscapeRightRotation);
  assertEquals(driver.rotation(), landscapeRightRotation);
}
origin: appium/java-client

@Test
public void testLandscapeLeftRotation() {
  new WebDriverWait(driver, 20).until(ExpectedConditions
      .elementToBeClickable(driver.findElementById("android:id/content")
          .findElement(MobileBy.AccessibilityId("Graphics"))));
  DeviceRotation landscapeLeftRotation = new DeviceRotation(0, 0, 270);
  driver.rotate(landscapeLeftRotation);
  assertEquals(driver.rotation(), landscapeLeftRotation);
}
origin: appium/java-client

@Test
public void testLandscapeRightRotation() {
  new WebDriverWait(driver, 20).until(ExpectedConditions
      .elementToBeClickable(driver.findElementById("android:id/content")
          .findElement(MobileBy.AccessibilityId("Graphics"))));
  DeviceRotation landscapeRightRotation = new DeviceRotation(0, 0, 90);
  driver.rotate(landscapeRightRotation);
  assertEquals(driver.rotation(), landscapeRightRotation);
}
origin: appium/java-client

@Test public void swipeTest() {
  WebDriverWait webDriverWait = new WebDriverWait(driver, 30);
  IOSElement slider = webDriverWait.until(driver1 -> driver.findElementByClassName("XCUIElementTypeSlider"));
  Dimension size = slider.getSize();
  ElementOption press = element(slider, size.width / 2 + 2, size.height / 2);
  ElementOption move = element(slider, 1, size.height / 2);
  TouchAction swipe = new TouchAction(driver).press(press)
      .waitAction(waitOptions(ofSeconds(2)))
      .moveTo(move).release();
  swipe.perform();
  assertEquals("0%", slider.getAttribute("value"));
}
org.openqa.selenium.support.uiWebDriverWaituntil

Popular methods of WebDriverWait

  • <init>
  • ignoring
  • withMessage
  • pollingEvery
  • withTimeout
  • ignoreAll
  • click
  • findElement
  • sleep
  • throwTimeoutException
    Override this method to throw an exception that is idiomatic for a given test infrastructure. E.g. J

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now