Hamid Mohayeji
Hamid Mohayeji

Reputation: 4275

NodeJS Get Completely Rendered HTML Page

I want to get a html page content from a url using NodeJS after JavaScript is fully loaded and the page is completely rendered, or get the basic html then run all JavaScript files to achieve final content. For example let's assume there is a website based on AngularJS, so the basic html is simple, but after loading all JavaScript codes in the page, page content is completely different. I want to get that final content on my server to find something in it. Any ideas?

Upvotes: 2

Views: 3442

Answers (2)

Hamid Mohayeji
Hamid Mohayeji

Reputation: 4275

Maybe it's too late, but back in the day, PhantomJS solved my problem.

Upvotes: 0

Abdennour TOUMI
Abdennour TOUMI

Reputation: 93163

After-Load is a NodeJS package that works like a charm :

var afterLoad=require('after-load');

then :

afterLoad('http://stackoverflow.com/questions/29366718',function(html){

       console.log(html.indexOf('charm')>0);
         //true 
})

Upvotes: 2

Related Questions