Questions tagged [phantomjs]

PhantomJS is a headless (GUI-less) WebKit with a JavaScript API. It has native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

PhantomJS is a headless (GUI-less) WebKit with a JavaScript API. It has native support for various web standards: handling, selector, , , and .

PhantomJS is a solution for headless testing of web-based applications, site scraping, page capture, renderer, converter and many other use cases. Since it isn't actually a browser, it is very fast.

PhantomJS was released January 23, 2011 by Ariya Hidayat after several years in development.

Related projects

PhantomJS has its own standalone execution environment, but it can be used through the wire protocol in various languages that provide bindings for . The tag should be used instead of [selenium] [webdriver] together.

is another standalone framework that is built on top of PhantomJS (and runs in PhantomJS).

PhantomJS needs some kind of bridge to be used directly from within a script. Popular bridges include phantom, node-phantom, nightmare ( version <1.8 used PhantomJS, now it's Electron), Horseman, navit, phridge, node-phantom-simple, jquery.go.js, SpookyJS (wrapper around CasperJS, which is a wrapper around PhantomJS), x-ray (use in addition ). Questions concerning those bridges should be tagged with as well as .

Documentation

7617 questions
61
votes
4 answers

How do poltergeist/PhantomJS and capybara-webkit differ?

What are the differences between PhantomJS and capybara-webkit? What are the advantages of capybara-webkit over PhantomJS? Which of the two is the most efficient tool? Others ...
Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
58
votes
3 answers

How to run mocha and mocha-phantomjs tests from one "npm test" command in node.js?

I have got few node packages which works in node.js environment and also in browser. Now I have got two seperate tests (for each environment). What is the best way to run these tests with just npm test command? Also I want to add these packages to…
David Kudera
  • 806
  • 2
  • 8
  • 14
56
votes
2 answers

How can I remove a whole IndexedDB database from JavaScript?

How can one remove a whole IndexedDB database from JavaScript, as opposed to just an object store? I'm using the IndexedDB shim, which may use WebSQL as its backend. I'd mainly like to know how to do this for the PhantomJS (headless) browser,…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
55
votes
7 answers

getting more information from phantomjs "SyntaxError: Parse error" message

I have a long script that was not written by me. When i run it I get: phantomjs file.js SyntaxError: Parse error i checked out the manual and --help, and the best i could came up with was: phantomjs --debug=yes file.js (irrelevant debug statement…
gcb
  • 13,901
  • 7
  • 67
  • 92
52
votes
4 answers

How can I control PhantomJS to skip download some kind of resource?

phantomjs has config loadImage, but I want more, how can I control phantomjs to skip download some kind of resource, such as css etc... ===== good news: this feature is added. https://code.google.com/p/phantomjs/issues/detail?id=230 The…
atian25
  • 4,166
  • 8
  • 37
  • 60
52
votes
1 answer

SVG images blocked by gmail proxy

It seems like the new gmail proxy for images doesn't work with SVG (gives a 404 error if you open the proxy url in a new tab.) I haven't been able to find any documentation about supported/blocked file-types. Is SVG in gmail working for anyone…
Redzarf
  • 2,578
  • 4
  • 30
  • 40
50
votes
7 answers

save html output of page after execution of the page's javascript

There is a site I am trying to scrape, that first loads an html/js modifies the form input fields using js and then POSTs. How can I get the final html output of the POSTed page? I tried to do this with phantomjs, but it seems to only have an option…
gyaani_guy
  • 3,191
  • 8
  • 43
  • 51
50
votes
4 answers

Why would a developer ever need PhantomJS as opposed to just using some testing framework?

I'm not sure why PhantomJS is necessary and I'm hoping someone can help.
Leila Hamon
  • 2,505
  • 7
  • 24
  • 32
49
votes
6 answers

How can I simulate a click event in my AngularJS directive test?

I've tried following the format of the ng-directive-testing repo for a directive I've written. The directive basically renders an overlay when the user clicks on an element. Here's the directive (simplified): mod.directive('uiCopyLinkDialog',…
Matt Andrews
  • 2,868
  • 3
  • 31
  • 53
48
votes
3 answers

How to enable cookie in phantomjsdriver selenium c#?

Following is my code : case BrowserType.PhantomJS: var service = PhantomJSDriverService.CreateDefaultService(Path.Combine(_rootPath, @"Packages\")); var cookieFilePath=Path.Combine(_rootPath, @"Packages\cookie.txt"); …
Prateek
  • 627
  • 1
  • 7
  • 19
48
votes
4 answers

PhantomJS hangs for a long time saying "Asynchronous Sessions clean-up phase starting NOW"

Here is a screenshot: task : Codeception PHP Testing Framework v1.6.2 Powered by PHPUnit 3.7.19 by Sebastian Bergmann. Suite selenium_acceptance started Trying to see the welcome page of newweather (welcomeCept.php) issue : it sits as it is and…
shab
  • 989
  • 1
  • 15
  • 31
47
votes
4 answers

How to scroll down with Phantomjs to load dynamic content

I am trying to scrape links from a page that generates content dynamically as the user scroll down to the bottom (infinite scrolling). I have tried doing different things with Phantomjs but not able to gather links beyond first page. Let say the…
Puneet Saini
  • 597
  • 1
  • 7
  • 12
45
votes
7 answers

Installing PhantomJS on Mac

I'm trying to install PhantomJS on my Mac (Yosemite). I did the following: npm install phantomjs Then I did: npm install phantomjs-prebuilt Both of which appear in my node_modules. But when I try to run phantomjs --versionI get -bash:…
jblakeley
  • 816
  • 1
  • 10
  • 20
45
votes
5 answers

How can I confirm what version of Jasmine I'm using?

If I recall there is a command in Jasmine that will log the exact version of Jasmine I'm running to the console, but I can't remember what it is. I am positive I have seen this before somewhere, and now that I actually need it I can't find it…
TheGuyWithTheFace
  • 2,615
  • 3
  • 13
  • 16
44
votes
1 answer

Debugging PhantomJS webpage.open failures

In PhantomJS, webpage.open takes a callback with a status parameter that's set to 'success' or 'fail'. According to the docs, it wll be "'success' if no network errors occurred, otherwise 'fail'." Is there a way to see the underlying network error…
josh
  • 9,038
  • 8
  • 31
  • 37