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
29
votes
4 answers

How to install PhantomJS v2 with npm

I'm trying to install PhantomJS v2.0.0 using npm and after trying a couple of methods I've not found a working solution... On NPM the latest version is 1.9.16, so I've tried the following in my package.json: "phantomjs":…
Zen
  • 7,197
  • 8
  • 35
  • 57
29
votes
12 answers

Testing AngularJS with Selenium

I have a SPA application on stack ASP MVC + AngularJS and I'd like to test the UI. For now I'm trying Selenium with PhantomJS and WebKit drivers. This is a sample testing page - view with single element. The list items
  • load dynamically from…
  • dr11
    • 5,166
    • 11
    • 35
    • 77
    29
    votes
    5 answers

    phantomjs page.evaluate not logging onto console

    I am a PhantomJs newbie. Just checked a similar post on this site. My question is why 'foo' is not logged to console or printed? var page = require('webpage').create() var foo = 42; function evaluate(page, func) { var args =…
    user1069596
    29
    votes
    2 answers

    PhantomJS compile with WebGL

    I am trying to compile PhantomJS to add WebGL. Apparently it is possible because of: post on groups.google.com post on trac.webkit.org However, I have no idea how to do this. I have looked in all the configuration for compiling and I tried and…
    charly
    • 956
    • 13
    • 23
    28
    votes
    7 answers

    PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH

    I am attempting to run this script: https://github.com/Chillee/coursera-dl-all However, the script fails at the line session = webdriver.PhantomJS() with the following error Traceback (most recent call last): File "dl_all.py", line 236, in…
    quantumbutterfly
    • 1,815
    • 4
    • 23
    • 38
    28
    votes
    3 answers

    Angular2 SEO - How to make an angular 2 app crawlable

    I am building an Angular 2 app using the Angular-Meteor framework. I would like to achieve fast and consistent indexing by google and other search engines, and allow Facebook sharer and other scrapers to generate previews of my JS-generated…
    Rayjax
    • 7,494
    • 11
    • 56
    • 82
    28
    votes
    4 answers

    Browser-based client-side scraping

    I wonder if its possible to scrape an external (cross-domain) page through the user's IP? For a shopping comparison site, I need to scrape pages of an e-com site but several requests from the server would get me banned, so I'm looking for ways to…
    eozzy
    • 66,048
    • 104
    • 272
    • 428
    28
    votes
    4 answers

    How to handle PDF pagination in PhantomJS

    I am using PhantomJS to create PDFs from html. It works fine, but I can't find out how to work with pagination; I want to create a page for each div in my document, but I can't find anything in the doc. about pagination. If my document is short, it…
    Rayjax
    • 7,494
    • 11
    • 56
    • 82
    28
    votes
    2 answers

    how to persist cookies between different casperjs processes

    this is a question about how to persist cookies from one casperjs page to another.. so basically i got a nodejs file that spawns casperjs as a worker to do certain tasks.. one is to login, once logged in I store the cookie in a file. when i spawn…
    abbood
    • 23,101
    • 16
    • 132
    • 246
    28
    votes
    7 answers

    can phantomjs work with node.js?

    I would like to use phantomjs in my node.js script. there is a phantomjs-node library.. but unfortunately the author used this weird coffee script code to explain what he's doing: phantom = require 'phantom' phantom.create (ph) -> ph.createPage…
    abbood
    • 23,101
    • 16
    • 132
    • 246
    28
    votes
    4 answers

    Alternative to PhantomJS for Testing

    I'm currently trying to build a little testing suite for CI (Hudson). I've written a complex script which dynamically invokes other Scripts and populates a given DIV element. My Selenium tests work for trivial examples (load www.google.com, search…
    schlingel
    • 8,560
    • 7
    • 34
    • 62
    27
    votes
    7 answers

    Install PhantomJS on MacOs 10.11 El Captian

    I can't install phantomJs in my macbook after upgrading to 10.11 (El Capitan). Whenever I try to install it using homebrew it gives me this error: $ brew install phantomjs phantomjs: OS X Yosemite or older is required. Error: An unsatisfied…
    jfcorugedo
    • 9,793
    • 8
    • 39
    • 47
    27
    votes
    2 answers

    How to disable or change the path of ghostdriver.log?

    Question is straightfoward, but some context may help. I'm trying to deploy scrapy while using selenium and phantomjs as downloader. But the problem is that it keeps on saying permission denied when trying to deploy. So I want to change the path of…
    Sam Stoelinga
    • 4,881
    • 7
    • 39
    • 54
    26
    votes
    11 answers

    No binary for PhantomJS browser on your platform. Please, set "PHANTOMJS_BIN" env variable

    My package.json looks like this.. "karma-phantomjs-launcher": "^0.1.4", "karma-safari-launcher": "^0.1.1", "karma-sinon-chai": "~0.2.0", "karma-spec-reporter": "~0.0.16", "mocha": "~1.20.1" my npm version is 2.2.0 whay am I getting this when I run…
    Sanath
    • 4,774
    • 10
    • 51
    • 81
    26
    votes
    2 answers

    Phantomjs dies by high memory consumption

    We are using phantomjs to run our qunit tests page on our TFS build server. Our version of test runner is built from below example https://github.com/ariya/phantomjs/blob/master/examples/run-qunit.js Over a period of time number of tests increased…
    lame_coder
    • 3,085
    • 3
    • 19
    • 21