dimanche 26 juillet 2015

PhantomJS running a script against a specific HTML file?

PhantomJS has the worst documentation ever. How do I run a simple .js against a specific html file? If I run phantomjs, I can use the REPL interface run require. How do I run that in such a fashion that window. is set as if a specific html file was the target?

I want to do something like

var $ = require('jquery');
$("div").attr('class');

and get the lists of classes... against this..

<html>
  <head><title>Hello World</title></title>
  <body>
    <div class="foo bar baz"> </div>
  </body>
</html>

Aucun commentaire:

Enregistrer un commentaire