Reputation: 1434
I am trying to get a page html content using request npm module. However the page contains ajax generated content so it takes some time to load that. That's why the request body is full of "spinners". What can I do to wait for page to finish loading before I get the body ?
Upvotes: 0
Views: 166
Reputation: 1281
The request module is working as intended; it is fetching the content at the url you are requesting. It is not responsible for executing javascript in that content to dynamically modify the dom as a web browser would do. For that, you want to use a headless web browser. Check out PhantomJS and the phantomjs-node module as a bridge. https://github.com/sgentle/phantomjs-node
Upvotes: 2