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

VCRProxy: Record PhantomJS ajax calls with VCR inside Capybara

I already did some research in this field, but didn't find any solution. I have a site, where asynchron ajax calls are made to facebook (using JSONP). I'm recording all my HTTP requests on the Ruby side with VCR, so I thought it would be cool, to…
23tux
  • 14,104
  • 15
  • 88
  • 187
42
votes
5 answers

TypeError: undefined is not a constructor

I'm very new to Angular and I'm trying to figure much of this out still. I'm writing some tests using Angular 1.5.8 which I generated from the Yeoman Generator. Specifically, I'm trying to figure out how to manipulate $httpBackend results (I'm not…
Adam Plocher
  • 13,994
  • 6
  • 46
  • 79
40
votes
3 answers

Unable to load Atom ''find_element"

I have recently installed PhantomJS and encountered this error on my first run: from selenium import webdriver from selenium.webdriver.common.keys import Keys driver =…
Clone
  • 3,378
  • 11
  • 25
  • 41
39
votes
5 answers

Karma, PhantomJS and es6 Promises

I am writing a JavaScript library that uses the new es6 promises. I can test the library in Firefox because promises are defined. However, when I try to test my code with Karma and PhantomJS, I get the error Can't find variable: Promise.. I am…
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
39
votes
7 answers

How to properly stop phantomjs execution

I initiated and close phantomjs in Python with the following from selenium import webdriver driver = webdriver.PhantomJS() driver.get(url) html_doc = driver.page_source driver.close() yet after the script ends execution I still find an instance…
CptNemo
  • 6,455
  • 16
  • 58
  • 107
36
votes
6 answers

Could not find phantomjs

Getting the following error when trying to use phantomjs from ruby on Ubuntu: Failure/Error: visit root_path Cliver::Dependency::NotFound: Could not find an executable ["phantomjs"] on your path. # ./spec/features/search_spec.rb:17:in `block…
Sergey Evstifeev
  • 4,941
  • 2
  • 24
  • 28
36
votes
5 answers

PhantomJS create page from string

Is it possible to create a page from a string? example: html = 'blah blah blah' page.open(html, function(status) { // do something }); I have already tried the above with no luck.... Also, I think it's worth mentioning…
mike
  • 8,041
  • 19
  • 53
  • 68
35
votes
5 answers

Does PhantomJS support cookies?

Does PhantomJS support cookies? If yes, where can I find the API details? I am not able to figure it out after searching for a while now.
Niyaz
  • 53,943
  • 55
  • 151
  • 182
35
votes
6 answers

How to Use CasperJS in node.js?

I would like to use CasperJS in node.js. I have referred to the following URL's to use CasperJS in node.js: https://github.com/sgentle/phantomjs-node http://casperjs.org/index.html#faq-executable With the help of the above URLs I have written the…
atian25
  • 4,166
  • 8
  • 37
  • 60
35
votes
5 answers

phantomjs: command not found

I followed these instructions (except for copying the executable to my PATH because I cannot seem to find it and it does not seem necessary). Then I made a file called image_render.js in my public javascripts directory with console.log('Hello,…
user730569
  • 3,940
  • 9
  • 42
  • 68
35
votes
3 answers

Scrape a webpage and navigate by clicking buttons

I want to perform following actions at the server side: 1) Scrape a webpage 2) Simulate a click on that page and then navigate to the new page. 3) Scrape the new page 4) Simulate some button clicks on the new page 5) Sending the data back to the…
user2129794
  • 2,388
  • 8
  • 33
  • 51
35
votes
4 answers

Getting remote debugging set up with PhantomJS

I'm trying to set up remote debugging with PhantomJS, without much luck. I am following the instructions at https://github.com/ariya/phantomjs/wiki/Troubleshooting. I have a little program named debug.js: var system = require('system' ), fs =…
user663031
35
votes
8 answers

Installing CasperJS on Windows: How to do it correctly?

I know there is a documentation from CasperJS website about how to install CasperJS on Windows, but bear with me these guys only explained for the pros only. If you are new to all this CasperJS and PhantomJS world, you dont stand a chance to…
user2075354
  • 409
  • 1
  • 4
  • 6
35
votes
2 answers

Is it possible to use Selenium WebDriver to drive PhantomJS?

I’m going through the documentation for the Selenium WebDriver, and it can drive Chrome for example. I was thinking, wouldn't it be far more efficient to ‘drive’ PhantomJS? Is there a way to use Selenium with PhantomJS? My intended use would be web…
Joseph
  • 3,899
  • 10
  • 33
  • 52
34
votes
3 answers

PhantomJS fails to open local file

I am trying to open a local HTML-file with PhantomJS (version 1.9.2): var page = require('webpage').create(), fs = require('fs'), address = "/Full/Path/To/test.html"; console.log('isFile? ' + fs.isFile(address)); console.log('isReadable? ' +…
AvL
  • 3,083
  • 1
  • 28
  • 39