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
378
votes
3 answers

Headless Browser and scraping - solutions

I'm trying to put list of possible solutions for browser automatic tests suits and headless browser platforms capable of scraping. BROWSER TESTING / SCRAPING: Selenium - polyglot flagship in browser automation, bindings for Python, Ruby, …
Inoperable
  • 1,429
  • 5
  • 17
  • 33
216
votes
8 answers

Is there a way to use PhantomJS in Python?

I want to use PhantomJS in Python. I googled this problem but couldn't find proper solutions. I find os.popen() may be a good choice. But I couldn't pass some arguments to it. Using subprocess.Popen() may be a proper solution for now. I want to…
flyer
  • 9,280
  • 11
  • 46
  • 62
165
votes
25 answers

How can I set up & run PhantomJS on Ubuntu?

I set up PhantomJS and recorded it to video: https://www.dailymotion.com/video/xnizmh_1_webcam Build instructions: http://phantomjs.org/build.html Is there anything wrong in my setup? After I set it up I read the quick start tutorial and tried to…
FURKAN ILGIN
  • 2,290
  • 3
  • 18
  • 21
160
votes
4 answers

How to submit a form using PhantomJS

I'm trying to use phantomJS (what an awesome tool btw!) to submit a form for a page that I have login credentials for, and then output the content of the destination page to stdout. I'm able to access the form and set its values successfully using…
Vijay Boyapati
  • 7,632
  • 7
  • 31
  • 48
152
votes
5 answers

Casperjs/PhantomJs vs Selenium

We are using Selenium to automate our UI testing. Recently we have seen majority of our users using Chrome. So we wanted to know - pros and cons of using PhantomJS vs Selenium: Is there any real advantage in terms of performance, e.g. time taken to…
spirit3189
  • 1,565
  • 3
  • 11
  • 9
146
votes
6 answers

How to make a SPA SEO crawlable?

I've been working on how to make a SPA crawlable by google based on google's instructions. Even though there are quite a few general explanations I couldn't find anywhere a more thorough step-by-step tutorial with actual examples. After having…
beamish
  • 2,827
  • 3
  • 15
  • 16
142
votes
14 answers

phantomjs not waiting for "full" page load

I'm using PhantomJS v1.4.1 to load some web pages. I don't have access to their server-side, I just getting links pointing to them. I'm using obsolete version of Phantom because I need to support Adobe Flash on that web pages. The problem is many…
nilfalse
  • 2,380
  • 2
  • 19
  • 16
105
votes
13 answers

PhantomJS failing to open HTTPS site

I'm using the following code based on loadspeed.js example to open up a https:// site which requires http server authentication as well. var page = require('webpage').create(), system = require('system'), t, address; page.settings.userName =…
Sreerag
  • 1,381
  • 3
  • 11
  • 16
83
votes
11 answers

PhantomJS; click an element

How do I click an element in PhantomJS? page.evaluate(function() { document.getElementById('idButtonSpan').click(); }); This gives me an error "undefined is not a function..." If I instead return…
user984003
  • 28,050
  • 64
  • 189
  • 285
79
votes
22 answers

Open web in new tab Selenium + Python

So I am trying to open websites on new tabs inside my WebDriver. I want to do this, because opening a new WebDriver for each website takes about 3.5secs using PhantomJS, I want more speed... I'm using a multiprocess python script, and I want to get…
Robert W. Hunter
  • 2,895
  • 7
  • 35
  • 73
73
votes
2 answers

Nodejs Child Process: write to stdin from an already initialised process

I am trying to spawn an external process phantomjs using node's child_process and then send information to that process after it was initialized, is that possible? I have the following code: var spawn = require('child_process').spawn, child =…
zanona
  • 12,345
  • 25
  • 86
  • 141
66
votes
6 answers

How to manage a 'pool' of PhantomJS instances

I'm planning a webservice for my own use internally that takes one argument, a URL, and returns html representing the resolved DOM from that URL. By resolved I mean that the webservice will firstly get the page at that URL, then use PhantomJS to…
Trindaz
  • 17,029
  • 21
  • 82
  • 111
66
votes
6 answers

PhantomJS: getting "Killed: 9" for anything I'm trying

Just installed phantomjs, mac os x yosemite. Whenever I run /bin/phantomjs, with any parameter, I get Killed: 9. Any idea?
azv
  • 1,583
  • 4
  • 18
  • 25
62
votes
6 answers

Save and render a webpage with PhantomJS and node.js

I'm looking for an example of requesting a webpage, waiting for the JavaScript to render (JavaScript modifies the DOM), and then grabbing the HTML of the page. This should be a simple example with an obvious use-case for PhantomJS. I can't find a…
Harry
  • 52,711
  • 71
  • 177
  • 261
61
votes
8 answers

Pass arguments with page.evaluate

I'm using PhantomJS page.evaluate() to do some scraping. My problem is that the code I pass to the webkit page is sandboxed, and so has no access to the variables of my main phantom script. This makes it hard make the scraping code…
TheFist
  • 623
  • 1
  • 5
  • 6
1
2 3
99 100