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

Reliably detecting PhantomJS-based spam bots

Is there any way to consistently detect PhantomJS/CasperJS? I've been dealing with a spat of malicious spambots built with it and have been able to mostly block them based on certain behaviours, but I'm curious if there's a rock-solid way to know if…
Terrakin
  • 241
  • 1
  • 2
  • 3
24
votes
7 answers

casperjs does not find phantomjs

I've downloaded the latest version of casperjs (1.03) and phantomjs (1.9.2). So I took this little simple script from the casper page: var casper = require('casper').create({ verbose: true, logLevel: "debug" }); var casper = new…
toom
  • 12,864
  • 27
  • 89
  • 128
24
votes
2 answers

Setting up JS debugging with IntelliJ/WebStorm and PhantomJS/Casper

Can I get an interactive JS debugger working on PhantomJS and/or CasperJS?
23
votes
7 answers

How to wait for page loading when using casperjs?

I am trying to scrape a webpage which has a form with many dropdowns and values in the form are interdependent. At many point I need the code to wait till the refresh of the page complete. Eg after selecting an option from the list, the code should…
qwerty123
  • 479
  • 1
  • 3
  • 14
23
votes
2 answers

How to set value of an input tag in casperJs

I have input element as shown : How can i set/fill its value using casperJs
user2129794
  • 2,388
  • 8
  • 33
  • 51
22
votes
2 answers

How Do I use jQuery in CasperJS?

casper.start(URL, function() { casper.page.injectJs('C:/Users/Mike/Documents/n1k0-casperjs-bc0da16/jquery-1.10.2.min.js'); var names = $('span.author-name'); this.echo(names); this.exit(); } ReferenceError: Can't find variable:…
Michael Yaworski
  • 13,410
  • 19
  • 69
  • 97
20
votes
1 answer

What must be wrapped in then() statements in CasperJS? How to determine execution order of sync/async functions?

I'm having something of a hard time determining what is asynchronous and what is not while running CasperJS, what must be wrapped in then() statements, and what is going to be evaluated when. I'll run into a problem somewhere that has to do with a…
Jeremy John
  • 13,686
  • 2
  • 16
  • 16
20
votes
1 answer

Performance of phantom.js vs zombie.js

I'm evaluating phantom.js and zombie.js. I expected the trade-off to be that phantom has wider documents support (since it uses a real renderer) while zombie is faster (since no rendering engine is used). However zombie seems much slower in the test…
Yaron Naveh
  • 23,560
  • 32
  • 103
  • 158
20
votes
4 answers

Grab the resource contents in CasperJS or PhantomJS

I see that CasperJS has a "download" function and an "on resource received" callback but I do not see the contents of a resource in the callback, and I don't want to download the resource to the filesystem. I want to grab the contents of the…
iwek
  • 1,608
  • 5
  • 16
  • 31
20
votes
1 answer

Output client-side console with casper/phantomjs

Going through the casperjs documentation I couldn't find where I could see the console.log from client-side javascript. Is this possible?
19
votes
1 answer

Fake navigator properties

I would like to fake Navigator platform property of CasperJS(/PhantomJS). I found the easy solutions of overwriting the Navigator Object at page load which is suggested in many other places on the web: casper.on('page.initialized', function(){ …
Alex
  • 1,914
  • 6
  • 26
  • 47
19
votes
2 answers

Run phantomjs with --ignore-ssl-errors=true from casperjs

I have a problem with https page. Page is completly ok, it exist but phantomjs tell me something else: 'loading resource failed with status fail'. I read about it for a while and for now i know it's phantomjs bug and the solution to this problem…
Piotr Wu
  • 1,362
  • 3
  • 14
  • 31
18
votes
5 answers

How to pass a variable as an argument to a CasperJS script through the command line?

I'm using PhantomJs, CasperJs, and Js in a js file ran through the cmd. Imagine we had two files(test1.js, and test2.js). Both files have a url/site variable that directs the test to a particular address. Everytime an environment changed or the…
user1816910
17
votes
1 answer

Is there a way to step in to CasperJS code and Debug step by step

Though I have been using CasperJS for some time, and rely on console logging for debugging. I was wondering if there is any IDE which support CasperJS step by step debugging or there is other way(remote debugging) to step in to CasperJS code? Has…
user2812866
  • 589
  • 1
  • 5
  • 15
17
votes
2 answers

How to modularize CasperJS test steps?

I am pretty new to CasperJS and I have started creating a test suite. Some of the steps (like logging in to the application) will be reused a lot, so we would like to manage them in library files (which are included in the test files). Plus, we…
eckhards
  • 171
  • 1
  • 3