PhantomJS mimic browsers?

208 views
Skip to first unread message

Stefan Perez

unread,
Aug 13, 2015, 10:20:13 AM8/13/15
to phantomjs
Hello I got a question about the process of PhantomJS. I read that PhantomJS support various web standards and I am using PhantomJS in combination with Jasmine test tool.

When I look at the code I see that for testing purposes PhantomJS creates a webpage object (which is in my case the test file) and run the test within my console window. Works like a harm but I got a question about running these test with PhantomJS.
Whenever I run the test in my browser (Chrome, IE or Firefox) sometimes there is a difference noticable within processing Javascript within those browsers.

How does PhantomJS do this? Because PhantomJS does not really renders a website as, for example, will selenium do. Can I be sure that if I test with PhantomJS that the test covered all the browsers?

Sean McNamara

unread,
Aug 13, 2015, 10:30:14 AM8/13/15
to phan...@googlegroups.com
On Thu, Aug 13, 2015 at 10:20 AM, Stefan Perez <stefan...@gmail.com> wrote:
Hello I got a question about the process of PhantomJS. I read that PhantomJS support various web standards and I am using PhantomJS in combination with Jasmine test tool.

When I look at the code I see that for testing purposes PhantomJS creates a webpage object (which is in my case the test file) and run the test within my console window. Works like a harm but I got a question about running these test with PhantomJS.
Whenever I run the test in my browser (Chrome, IE or Firefox) sometimes there is a difference noticable within processing Javascript within those browsers.

Of course, since PhantomJS uses a different JavaScript execution engine than any of those browsers. However, any specific "difference" you find could be a bug, so maybe it's better to actually tell us *what* those differences are, specifically.

 

How does PhantomJS do this? Because PhantomJS does not really renders a website as, for example, will selenium do. Can I be sure that if I test with PhantomJS that the test covered all the browsers?

PhantomJS *is* a web browser. Specifically, it's what you get when you instantiate an instance of QtWebKit's browser using Qt (based on whichever version of Qt is underlying the version of PhantomJS you're running).

You didn't state what version of PhantomJS you're running, but if it's not 2.x, the version of WebKit included there is quite old. Its JSCore doesn't support most of ES5. So of course you'd see different behavior (and probably things not working at all) compared to modern Chrome/Firefox or even modern IE.



 

--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages