Selenium with WebDriver – wait

I have a Selenium test suite in Java, using WebDriver. I have a generic wait function in place that takes a CSS selector and wait for the element to become present and visible before moving on to assertions, using WebDriverWait. Now, though, I want to have something that waits for all elements of a certain type, that are in the DOM to not be visible anymore, before proceeding. The exact example is that I have a number of images being loaded and I want to wait for their loading spinners to disappear before continuing. Haven’t been able to find something that would solve this for me yet, so posting it here. Any clues?


public void waitForPageToLoad(WebDriver webDriver, String cssToWaitFor) {
    WebDriverWait wait = new WebDriverWait(webDriver, 20);

Ruby Selenium WebDriver wait for keypress

SO. How I can do next?: wait = => 1000) wait.until{ // here insert code // for catching keypress driver.quit // e.g. } I need set pause for test until I

Wait is not working in selenium webdriver

I need help on wait function in Selenium webdriver. I have the following code to wait for Progressing Pop up to disappear. It seems it waits only for some seconds and terminates the script. Please l

Selenium Webdriver wait.until is not working

So I am starting to use Selenium Webdriver and I am encountering a problem with the until method from Below is my code: from selenium import webdriver import time from

Selenium WebDriver JS – Explicit Wait

I am using the selenium-webdriverjs. I want to wait for a certain element to be displayed for which I have created an explicit wait as follows and it works just fine, var displayed = false; driver.wai

Selenium::WebDriver Wait (Ruby, Chrome)

I have a ruby script that opens a browser. I have it set to open Firefox first and then Chrome if FF fails for some reason – like FF gets updated and Selenium hasn’t caught up yet. The wait function/d

implicit wait is not working in selenium webdriver

I am trying to wait on an element to be visible so i have set a implicit wait in the method bellow: public boolean isDisplayed(String xpathElement,int timeOut ) { boolean found = true; try { driver.

Which is the better option to handle errors between wait and sleep with selenium-webdriver?

We sometimes use sleep(10) or sometimes as below: wait = => 10) # seconds element = wait.until { driver.find_element :name => search } element = driver.f

selenium webdriver wait till element is displayed

I have searched on Google and the SO site and I get answers for JAVA but do not seem to get answers for node.js I have a web app that takes time to load. I would selenium program to wait till the page

Selenium WebDriver: Fluent wait works as expected, but implicit wait does not

I am new to Selenium WebDriver and am trying to understand the correct way to ‘wait’ for elements to be present. I am testing a page with a bunch of questions that have radio button answers. As you se

WebRat+Selenium WebDriver: wait for ajax to be completed

We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is


Check the invisibilityOfElementLocated expected condition. Reference. From the doc:


public static ExpectedCondition<java.lang.Boolean> invisibilityOfElementLocated(By locator)

An expectation for checking that an element is either invisible or not present on the DOM.

    locator - used to find the element

So you could use it like:

public void waitForInvisibility(WebDriver webDriver, String cssToWaitFor) {
    WebDriverWait wait = new WebDriverWait(webDriver, 20);

Alternatively you can look into public static ExpectedCondition<java.lang.Boolean> not(ExpectedCondition<?> condition), which by the doc does:

An expectation with the logical opposite condition of the given condition.