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

downloading a file that comes as an attachment in a POST request response in PhantomJs

I want to download a CSV file, it is generated on a button click through a POST request. I researched to my best on casperJs and phantomJS forums and returned empty handed. In a normal browser like firefox, a browser download dialog window appears…
vumaasha
  • 2,765
  • 4
  • 27
  • 41
17
votes
3 answers

casperjs click() a form element to submit, wait, run queries on next page?

I would like to click a submit button, wait for the next page to load, then obtain html on that second page.. I do the start, then and run, but the then step is still run on the first page. Any ideas? var casper = require('casper').create(); var…
tester
  • 22,441
  • 25
  • 88
  • 128
16
votes
4 answers

How to Login by filling the form in CasperJs

Following is the hlml of the login form that I have
16
votes
1 answer

How to test if selector exists in CasperJS?

I know I can use: casper.test.assertExists(#selector); But I want to actually store if it exists in a boolean variable. I.e. something like this: var exists = SelectorExists(#selector);
Henley
  • 21,258
  • 32
  • 119
  • 207
16
votes
2 answers

Casperjs inspect a javascript Object

How can I inspect an object in a casperjs script ? I tried console.log(arguments) but it only prints [object Arguments] or [object Object]. I would like to expect something like: { 'firstparam': 'value' ... } Like in the Javascript console or in…
Charles
  • 11,367
  • 10
  • 77
  • 114
15
votes
3 answers

Programmatically get web request initiator

The Chrome Dev Tools network tab has an initiator column that will show you exactly what code initiated the network request. I'd like to be able to get network request initiator information programmatically, so I could run a script with a url and…
15
votes
4 answers

what is a dubious test in casperjs

When running a test getting. FAIL 35 tests executed in 16.806s, 35 passed, 0 failed, 2 dubious, 0 skipped. What does the 'dubious' imply and how to see which assertion or test case is dubious?
M T
  • 4,099
  • 4
  • 21
  • 27
14
votes
3 answers

CasperJS loop or iterate through multiple web pages?

I have a CasperJS script that scrapes ratings and dates from one webpage. Now I want to scrape the same data from multiple pages under the same website. How can I loop through the different subpages given this code: var ratings = []; var dates =…
karansolo
  • 301
  • 1
  • 2
  • 8
14
votes
3 answers

how to scrape links with phantomjs

Can PhantomJS be used an an alternative to BeautifulSoup? I am trying to search on Etsy and visit all the links in term. In Python, I know how to do this (with BeautifulSoup) but today I want to see if I can do the same with PhantomJS. I'm not…
john mangual
  • 7,718
  • 13
  • 56
  • 95
14
votes
1 answer

CasperJS dont load page resources

How can I tell casper not to load images,css ,js videos etc . So I am interested only in DOM elements .
narek
  • 1,026
  • 2
  • 12
  • 30
13
votes
1 answer

casperjs doesn't work as expected on windows machine

I have a casperjs script which gives the desired result when I run on a linux server, but when I run the same from my laptop, it doesn't work. How should I debug? Logs of the working one: [info] [phantom] Starting... [info] [phantom] Running suite:…
GrSrv
  • 551
  • 1
  • 4
  • 22
13
votes
2 answers

How to send cookies with CasperJS

I think that every request that I send is being sent without cookies.. When I listen to the onResourceRequested event like this: this.page.onResourceRequested = function(request) { utils.dump(request); }; And every request has the same form of…
carmel
  • 902
  • 7
  • 24
13
votes
1 answer

What does the "test.begin()" function mean in CasperJS?

I don't quite understand the function test.begin(String description, Number planned, Function suite). What is the parameter Number planed for?
firefly
  • 131
  • 3
13
votes
1 answer

SlimerJS extensions.getAddons.cache.enabled

I'm having an issue running SlimerJS through CasperJS, I get the next message "1414441945905 addons.repository WARN cacheEnabled: Couldn't get pref: extensions.getAddons.cache.enabled". I have a nodejs scraper running with CasperJS and Slimer…
XcKoN
  • 131
  • 4
13
votes
5 answers

How to get currently executed file directory in CasperJS

I'm using CasperJS to check some site and write JSON data into a file. File should be written into public/data folder. But when I'm trying to call casperjs outside of my project directory (e.g. my home directory), it writes file directly in…
ValeriiVasin
  • 8,628
  • 11
  • 58
  • 78