on-internet
← Community

How to wait for page to load completely using JavaScript in Selenium

Stack Overflow ·

I'm trying get for page to load completely before doing an action. I don't want to start an action while loading circle on the browser tab is still turning. My wait for ajax function is not working for some cases, especially for new page loading. My function is JQuery based: JavascriptExecutor jsDriver = (JavascriptExecutor) webDriver; boolean stillRunningAjax = (Boolean) jsDriver .executeScript("return window.jQuery != undefined && jQuery.active != 0"); return !stillRunningAjax; if that comes false, running it again. But for page loading, after it returns true, browser is still loading (loadi

Comments

Sign in or sign up to comment and upvote.

No comments yet.