This recipe will detail how to simulate rich web interactions using CasperJS, in order to achieve more complex testing.
The following sections cover the various steps in writing advanced tests.
First, let's learn how to download files. The most common way to download a file from a web page is by providing a link to this file as follows (
<html><body> <h1>My example</h1> <a id="link-to-text" href="files/text.txt">Download a text</a> <a id="link-to-pdf" href="files/text.pdf">Download a PDF</a> </body></html>
Now, let's create the following CasperJS script (
var casper = require('casper').create(); casper.start('http://localhost:8000/example4.html', function() ...