Server side browser that can execute JavaScript

后端 未结 9 1215
北海茫月
北海茫月 2021-01-05 08:05

Is there any programming libraries available that will parse an HTML document, execute JavaScript and then allow me to navigate the DOM?  This needs to be performed server s

9条回答
  •  情书的邮戳
    2021-01-05 08:41

    There are now several projects that do a really good job of this:

    • PhantomJS is a headless version of WebKit, and there are some helpful wrappers such as CasperJS.

    • Zombie.js which is a wrapper over jsdom written in Javascript (Node.js).

    You need to write JavaScript code to interact with both of these projects. I like Zombie.js better so far, since it is easier to set up, and you can use any Node.js/npm modules in your code.

提交回复
热议问题