daveoncode
daveoncode

Reputation: 19578

How can I test JavaScript output in the DOM without a browser?

I would like to test the output generated by some functions which are responsible to generate new content in the dom. The problem is that I need to test such scenarios without using a browser and by running xpath queries against the generated output. (something like HTMLUnit in Java). How can I write such tests? Which framework/technology can I use?

Upvotes: 0

Views: 230

Answers (1)

Quentin
Quentin

Reputation: 943193

This is usually handled by using a browser running on a fake screen (e.g. using xvfb) and driving it programmatically. Headless will let you set up xvfb from within node.js.

Phantom and Selenium provide a couple of ways to drive browsers.

Upvotes: 1

Related Questions