Last Updated: February 25, 2016
· krzysztof-jelski

Wait until animation is finished with WebDriver and Geb

If you have a jquery animation like slideDown and want to make sure it is finished in your Selenium/WebDriver/Geb test, try the following:

waitFor {
    !js.exec('return jQuery("#id_of_my_element").is(":animated");')

This will wait until animation od #id_of_my_element is finished. What makes it possible is jQuery's :animated selector.
Of course, you can replace #id_of_my_element with any jQuery selector you need.