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


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

    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 = ->
