5

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?

2
  • 1
    If screen scraping is what your after, check out: blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs Commented Mar 7, 2011 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. Commented Mar 7, 2011 at 17:15

3 Answers 3

5

You can check the zombie.js project : http://zombie.labnotes.org/

It should load the page mostly as in a real browser.

Sign up to request clarification or add additional context in comments.

1 Comment

Great project!! It directly solves my problem of loading HTML after running the javascript!
4

Something like JSDOM should do it.

https://github.com/tmpvar/jsdom

1 Comment

Right, but can't figure out how to I get not just HTML/JS of the window, but the result of their execution there.
1

Also, a great solution is https://github.com/GoogleChrome/puppeteer. Which is Headless Chrome Node API and maintained by Chrome DevTools team.

1 Comment

But it is very slow at loading pages, while still faster than competitors like Phantom

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.