 
 # Building resulting page and image
 buildPage = ->
-    this.echo 'Build result page'
+    @echo 'Build result page'
     fs = require 'fs'
     @viewport 624, 400
     pageHtml = "<html bgcolor=black><body>"

    if currentLink < nbLinks
        @click ".carousel_itemList_li[rel='#{currentLink}']"
        @wait 1000, ->
            this.then next
            currentLink++
    else
        this.then buildPage

casper.then next


    pageHtml += "</body></html>"
    fs.write 'result.html', pageHtml, 'w'
    @thenOpen "file://#{fs.workingDirectory}/result.html", ->
        @echo 'Resulting image saved to result.png'
        @capture 'result.png'

# Capture carrousel area
next = ->
