I was trying to work out how to wait for AJAX calls to complete in C# WebDriver before continuing a test.
I wrapped this into a WebDriver extension method on Driver, so you can call it like this:
The actual extension method looks like this:
public static void WaitForAjax(this IWebDriver driver, int timeoutSecs = 10, bool throwException=false)
for (var i = 0; i < timeoutSecs; i++)
if (ajaxIsComplete) return;
throw new Exception("WebDriver timed out waiting for AJAX call to complete");
I hope you find this helpful if you’re ever in the same situation.