Skip to content
/ casperjs Public
forked from casperjs/casperjs

Set up casperjs local environment with phantomjs 2.0 for mac and win.

License

Notifications You must be signed in to change notification settings

flyHe/casperjs

 
 

Repository files navigation

CasperJS For PhantomJS 2.0

CasperJS is a navigation scripting & testing utility for PhantomJS and SlimerJS.

**This project is created to set up casperjs environment with phantomjs 2.0 ** It followed the Casperjs git repository.

How to install

**For windows: **

  • npm install git://github.com/flyHe/casperjs

**For mac: **

  • npm install git://github.com/flyHe/casperjs
  • cd node_modules/casperjs/phantom/
  • chmod +x phantomjs

**For RHEL 6: **

  • in progress

Sample test

First install CasperJS

Sample test to see if some dropdown can be opened:

casper.test.begin('a twitter bootstrap dropdown can be opened', 2, function(test) {
    casper.start('http://getbootstrap.com/2.3.2/javascript.html#dropdowns', function() {
        test.assertExists('#navbar-example');
        this.click('#dropdowns .nav-pills .dropdown:last-of-type a.dropdown-toggle');
        this.waitUntilVisible('#dropdowns .nav-pills .open', function() {
            test.pass('Dropdown is open');
        });
    }).run(function() {
        test.done();
    });
});

Then add test scripts into package.json

{
  "name": "twitter-dropdown-test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "test": "casperjs test twitter-dropdown-test.js"
  },
  "devDependencies": {
    "casperjs": "git://github.com/flyHe/casperjs"
  }
}

Run the script:

npm run test

Other

About

Set up casperjs local environment with phantomjs 2.0 for mac and win.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 89.3%
  • Python 4.0%
  • HTML 3.8%
  • C# 1.1%
  • CoffeeScript 1.1%
  • Shell 0.3%
  • Other 0.4%