What Is CasperJS - 3/6

Published: 08 February 2016
on channel: JsWiz
5,281
26

Full Course: https://goo.gl/QEo1ie

This video describes what CasperJS is and what you can do with it.

CasperJS is defined on their website as a navigation scripting & testing utility for the PhantomJS WebKit headless browser. It provides useful high-level functions, methods & syntactic sugar for doing common tasks.

These common tasks include: defining & ordering navigation steps, filling & submitting forms, clicking & following links, capturing screenshots of a page, testing remote DOM, downloading resources, writing functional tests, and scraping Web contents.

Web Scraping is of course the focus of this course and we'll be using most of these common tasks when writing our scripts.

As mentioned, Casper provides helper methods that abstract away a lot of code we would normally have to write if using PhantomJS by itself. Lets take a quick look at a few of these methods.

In the Phantom API there is no way built in way to wait for a selector to appear. So you might have a page that's retrieving some data and you need to wait for the page to load before some grabbing data. -- Here we can see an example of how to perform this action in the PhantomJS docs. But in CasperJS, we are provided with handy methods like waitFor that we can pass in a function and arguments as well as waitForSelector which will wait until a given selector is loaded before proceeding with the script.


Watch video What Is CasperJS - 3/6 online without registration, duration hours minute second in high quality. This video was added by user JsWiz 08 February 2016, don't forget to share it with your friends and acquaintances, it has been viewed on our site 5,28 once and liked it 2 people.