I believe there are several modules (e.g. Ghost ), but I used Selenium / WebDriver for such things. This is supposedly a test environment, but it provides you with many methods that allow you to interact with the page in the same way as if you loaded it as a regular user. You also have the advantage of running it so that the browser really opens, and you can watch the code run (simplifies debugging) or in the headless mode where the code is just running (there are other answers to / SO sites with much better explanations, than I can give :)).
Having said that, Ghost looks great, so try both of them, and I hope you get what you need!
Also see the Javascript engine (and HTML rendering) without a graphical interface for automation? for a similar question, which may contain some additional answers.
source share