Questions tagged [casperjs]

CasperJS is a JavaScript based navigation scripting & testing utility for PhantomJS (WebKit) and SlimerJS (Gecko). See SpookyJS for the use of CasperJS inside of node.js.

Definition:

From the Official Documentation:

CasperJS is an open source navigation scripting & testing utility written in JavaScript for the headless browser and (). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:


Important Links:


Related Tags:

2447 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
97
votes
3 answers

What Does 'Then' Really Mean in CasperJS

I'm using CasperJS to automate a series of clicks, completed forms, parsing data, etc through a website. Casper seems to be organized into a list of preset steps in the form of then statements (see their example here:…
bendytree
  • 13,095
  • 11
  • 75
  • 91
53
votes
3 answers

Frontend testing: what and how to test, and what tool to use?

I have been writing tests for my Ruby code for a while, but as a frontend developer I am obviously interested in bring this into the code I write for my frontend code. There is quite a few different options which I have been playing around…
DJ Forth
  • 1,518
  • 2
  • 18
  • 26
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
43
votes
4 answers

Write results into a file using CasperJS

How do I create a file in the file system and place the contents of this.getPageContent() inside it?
narek
  • 1,026
  • 2
  • 12
  • 30
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
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
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
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
4 answers

console.log doesn't work in CasperJS' evaluate with setTimeout

Why when I use console.log in evaluate, it works: casper.then(function() { this.evaluate( function() { console.log('hello'); }); }); But this doesn't work: casper.then(function() { this.evaluate( function() { setTimeout( function()…
Rustem
  • 2,884
  • 1
  • 17
  • 32
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
25
votes
1 answer

File IO inside CasperJS

Is it possible do read/write files inside a CasperJS Script ? var fs = require('fs'); var data = fs.readFileSync('testdata.data', 'utf-8'); console.log(data); Calling casperjs fileio.jsreturns: 'undefined' is not a function Even after running npm…
AsTeR
  • 7,247
  • 14
  • 60
  • 99
24
votes
4 answers

CasperJS and 'Unsafe JavaScript attempt to access frame with URL' error

I have simple page with javascript which validates email written in input: email.html: Email validation
michaeluskov
  • 1,729
  • 7
  • 27
  • 53
24
votes
1 answer

Taking reliable screenshots of websites? Phantomjs and Casperjs both return empty screen shots on some websites

Open a web page and take a screenshot. Using ONLY phantomjs: (this is a simple script, in fact it is the example script used in their docs. http://phantomjs.org/screen-capture.html var page =…
MrPizzaFace
  • 7,807
  • 15
  • 79
  • 123
24
votes
1 answer

CasperJS/PhantomJS doesn't load https page

I know there are certain web pages PhantomJS/CasperJS can't open, and I was wondering if this one was one of them: https://maizepages.umich.edu. CasperJS gives an error: PhantomJS failed to open page status=fail. I tried ignoring-ssl-errors and…
Vishaal Kalwani
  • 730
  • 1
  • 7
  • 20
1
2 3
99 100