I am trying to use npm request and cheerio to pull webpages and parse their html. This works fine for cases where the html is loaded on request. But I am having an issue where the site loads a loading screen first and then updates the page with new info / elements after a few moments.
Partial code:
var url = 'website with loading screen prior to content.com';
var request = require('request');
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
})
What I would like - Either request having the ability to wait for a specific element to show up on the page and then read the body. OR be able to wait a fixed number of seconds and then read the body
Other options - It might not be possible with npm request, which is fine. If that is the case could you please point me in the correct direction. My other options that I am considering are using webdriver.io or phantomjs. Is there a recommended course of action for this?