Use jQuery DOM syntax syntax in PhantomJS?

I am studying PhantomJS and wondering if it is possible to use jQuery DOM selectors in PhantomJS JS files? I saw a short github example that seems to point to this:

PhantomJS example with Qunit (and jQuery?)

If you look at the run-qunit.js file at the top of the screen, it seems that you can use the jQuery DOM selector as parameters. But I get errors when I do this - not sure if this is my syntax, or because Phantom doesn't know about jQuery, so I thought I'd ask about the PhantomJS / jQuery relationship first.

+7
source share
3 answers

Use page.injectJs ('jquery-1.6.1.min.js'); it will work fine.

here is a nice link for using jquery in phantomjs http://snippets.aktagon.com/snippets/534-how-to-scrape-web-pages-with-phantomjs-and-jquery

+5
source

There are people who say that the documentation samples loading jQuery are errors and loading jQuery on PhamtomJS is not possible here: loading jquery on phanthomjs

+2
source

.. well, as soon as I posted, I (naturally) found this. It looks like you can actually enable jQuery:

https://github.com/ariya/phantomjs/wiki/Page-Automation

0
source

All Articles