Skip to content

Exercises to demonstrate uses of PhantomJS and CasperJS

Notifications You must be signed in to change notification settings

doronha/casperjs_exercises

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

CasperJS Exercises

Initial Setup

Exercise 1

  • Modify Phantom's follow.js example to display the Twitter followers from the @bmorejs and your own account (if any).

  • Observe the amount of control you have over the browser, but then see how cumbersome writing code like this would be for a more complex scraping application.

  • Run Casper's googlelinks.js example with your own search terms (like your name).

Exercise 2

  • Rewrite the follow.js code to run with Casper. There's a sample answer in the js/solutions directory of this project. No peeking unless you're stuck!

  • Modify googlelinks.js or follow.js to take a screenshot of the results page and save as a png file using Casper's capture method.

Exercise 3

  • Write a basic site availability tester for one of your current projects using Casper's Tester module. Check out this example for inspiration. You can run echo $? after Casper finishes to see an exit code (0 if the tests all pass; otherwise 1);

  • There's also a solution for this exercise in js/solutions; again, no peeking!

Extra Credit Exploration

About

Exercises to demonstrate uses of PhantomJS and CasperJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published