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
34
votes
2 answers

How to login into a website with CasperJS?

How can I login with CasperJS by submitting a form. I searched google and haven't found any good examples about it.
user1647411
33
votes
2 answers

How to use ES6 with PhantomJS

Is there a way to use ES6 and modules with PhantomJS? I can transpile each file from ES6 to ES5 using Babel, but it's awkward to maintain parallel trees (one in ES6 and another in ES5) and write the imports to require the ES5 modules. I'm looking…
exupero
  • 9,136
  • 8
  • 47
  • 63
33
votes
5 answers

How can I scrape pages with dynamic content using node.js?

I am trying to scrape a website but I don't get some of the elements, because these elements are dynamically created. I use the cheerio in node.js and My code is below. var request = require('request'); var cheerio = require('cheerio'); var url =…
JayD
  • 15,483
  • 5
  • 15
  • 14
33
votes
3 answers

HtmlUnitDriver (HtmlUnit) vs GhostDriver (PhantomJS)?

We are in the middle of choosing our headless browser driver solution that will be some implementation of Selenium WebDriver. There is the GhostDriver, which leverages the PhantomJS in the backend on the one side and HtmlUnitDriver which based on…
Johnny
  • 14,397
  • 15
  • 77
  • 118
32
votes
1 answer

ffmpeg throwing "Output file #0 does not contain any stream" when trying to make a slideshow out of images

Im trying to create video streaming using phantomjs that create screenshots from a url then it will pipe the frames to ffmpeg so he can use it to stream the video to an rtmp url . here is what i tried so far : phantomjs runner.js | ffmpeg -f…
Abdou Tahiri
  • 4,338
  • 5
  • 25
  • 38
32
votes
5 answers

Performant parsing of HTML pages with Node.js and XPath

I'm into some web scraping with Node.js. I'd like to use XPath as I can generate it semi-automatically with several sorts of GUI. The problem is that I cannot find a way to do this effectively. jsdom is extremely slow. It's parsing 500KiB file in a…
polkovnikov.ph
  • 6,256
  • 6
  • 44
  • 79
32
votes
10 answers

phantomjs screenshot font missing, boxes rendered instead

I am using PhantomJs 1.8.1 on Centos 6.3 to for automated ui tests. When a test fails, screenshots are saved to the file system. My problem is that even though the screenshots are saved, they do not contain readable fonts. So if the website reads…
nemoo
  • 3,269
  • 4
  • 38
  • 51
32
votes
5 answers

How do I access an iframe from CasperJS?

I have a webpage with an iframe. I'd like to access the contents of the iframe using CasperJS. In particular, I need to click buttons and fill a form. How can I do that? The main webpage is main.html:
Jim Paris
  • 888
  • 2
  • 9
  • 15
31
votes
2 answers

ReferenceError: Can't find variable: jQuery with Poltergeist/Capybara

What I'm trying to Do I'm trying to use capybara with poltergeist to log into amazon at this URL... https://developer.amazon.com/rp/sales.html Simple enough, except that when I try to submit the form, I get the error... ReferenceError: Can't…
Eric Slick
  • 319
  • 3
  • 3
31
votes
3 answers

How to increase the timeout in CasperJS

I am using waitFor(). The code as below: casper.waitFor(function check() { return this.evaluate(function() { return this.evaluate(someFunction, 'variable 1','variable 2','variable 3') === 'yes'; }); }, function then() { …
user2129794
  • 2,388
  • 8
  • 33
  • 51
31
votes
1 answer

phantomJS webpage timeout

I have set up a script to create webshots of our app. It runs perfectly and all is fine Until I encounter an image with a broken url : "" I have managed to…
Kim Isaksen
  • 311
  • 1
  • 3
  • 4
30
votes
4 answers

How to avoid being detected as bot on Puppeteer and Phantomjs?

Puppeteer and PhantomJS are similar. The issue I'm having is happening for both, and the code is also similar. I'd like to catch some informations from a website, which needs authentication for viewing those informations. I can't even access home…
30
votes
1 answer

PhantomJS: specify User Agent when making a call

I am using PhantomJS to make calls to a web page, like this: page.open('http://example.com', function (s) { console.log(page.content); phantom.exit(); }); I am using this in the context of Drupal Simpletests, which require me to set a special…
alberto56
  • 2,997
  • 3
  • 28
  • 47
30
votes
6 answers

Cannot install phantomJS in Karma

WARN [config]: config.configure() is deprecated, please use config.set() instead. WARN [plugin]: Cannot find plugin "karma-phantomjs". Did you forget to install it ? npm install karma-phantomjs --save-dev INFO [karma]: Karma v0.10.2 server…
Marty Lavender
  • 373
  • 1
  • 3
  • 8
29
votes
5 answers

Unit Testing/mocking Window properties in Angular2 (TypeScript)

I'm building some unit tests for a service in Angular2. Within my Service I have the following code: var hash: string; hash = this.window.location.hash; However when I run a test which contains this code, it will fail. It'd be great to utilise all…
Rhys
  • 375
  • 1
  • 5
  • 10