Wait until a page with JQuery is loaded in Selenium Webriver

  • I have a problem. Page is completely loaded but jquery is still in progress and there are some web forms with webelements that can be absent for some period of time that's why when selenium webdriver try to click on the button just after page is loaded, it fails to find webelement
    Do you guys know how to wait for jquery to finish?

  • You can use ExecuteScript and javascript to handle JQuery:

    var driverWait = new WebDriverWait(Driver, TimeSpan.FromSeconds(5));
    driverWait.Until(d => (long)js.ExecuteScript("return jQuery.active") == 0);

Suggested Topics