Omu Omu - 2 years ago 116
Ajax Question

wait for an ajax call to complete with Selenium 2 web driver

I'm using selenium 2 web driver to test an ui which uses AJAX.

Is there a way to make the driver to wait for a bit so that the ajax request will complete

basically I have this:

// this^ click triggers an ajax request which will fill the below Id with content
// so I need to make it wait for a bit


Answer Source
var wait = new WebDriverWait(d, TimeSpan.FromSeconds(5));
var element = wait.Until(driver => driver.FindElement(By.Id("Hobbies")));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download