Waiting for jQuery
I was talking to someone earlier today who has a very jQuery site; animations, transitions, ajax-y goodness, etc. and realized I had not yet posted this little recipe. jQuery.active is, well, an internal latch that jQuery has that is not part of the official documentation, but that lots of people use. The implementation details are discussed in the first answer of this stackoverflow question (just ignore the warning around the namespace, seems that was reverted)
<pre lang="python">def wait_for_jquery_active(self):
w = WebDriverWait(self.driver, self.config.getint("Selenium", "timeout"))
w.until(lambda driver : driver.execute_script("return jQuery.active === 0"))
This obviously won’t work if you are just firing html level js events, but if you are waiting on jQuery stuff I’ve had luck with this.