So, I have my Node.js script. And I have some HTML page which contains HTML with JavaScript (jquery) in it. How can I load it and get result of execution of JavaScript on this page?
Asked
Active
Viewed 8,107 times
5
-
1If screen scraping is what your after, check out: http://blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs – Brandon Boone Mar 07 '11 at 16:56
-
My HTML page does some manipulations with divs -- and I need to get the result of those manipulations. It's not the screenscrapping to get the source HTML w/ Javascript, but actually the result of their execution. – alexeypro Mar 07 '11 at 17:15
3 Answers
5
You can check the zombie.js project : http://zombie.labnotes.org/
It should load the page mostly as in a real browser.

Jerome WAGNER
- 21,986
- 8
- 62
- 77
-
Great project!! It directly solves my problem of loading HTML after running the javascript! – Ting Yi Shih Nov 07 '16 at 03:50
4
Something like JSDOM should do it.

Mark Bolusmjak
- 23,606
- 10
- 74
- 129
-
2Right, but can't figure out how to I get not just HTML/JS of the window, but the result of their execution there. – alexeypro Mar 07 '11 at 17:16
1
Also, a great solution is https://github.com/GoogleChrome/puppeteer. Which is Headless Chrome Node API and maintained by Chrome DevTools team.

pocheptsov
- 1,936
- 20
- 24
-
But it is very slow at loading pages, while still faster than competitors like Phantom – Manuel Di Iorio Mar 20 '21 at 09:36