javascript - How to detect ajax driven websites -


here want know webpage has ajax calls or not. because if webpage ajax based wait few seconds web page contents, or else if webpage not ajax based not wait .

i followed below code didn't result.

webdriver driver = new phantomjsdriver(caps); driver.get("http://www.airgas.com/category/safety-products-clothing-workclothing-acc/_/n-0z84v");  javascriptexecutor js = (javascriptexecutor)driver; js.executescript("$(document).ready(function() {     $(document).ajaxstart(function(event, request, settings) {         alert("web page have ajax calls");     }); }); ); 

if use jquery code used in javascriptexecutor in developers console getting alert message stating webpage has ajax calls or not. approach correct? if not correct solution problem.

looks you're looking answer: how know if jquery has ajax request pending?

with twist you'll need give first time execute , launch requests , check if active. if active can wait till done.

hth


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -