How to use mouse in SpookyJS?

178 views Asked by At

How to use mouse in SpookyJS? In CasperJS I can use mouse:

var casper = require('casper').create();
var mouse = require("mouse").create(casper);

How can I do it with SpookyJS?

1

There are 1 answers

0
Kevin Gagnon On

To access any Casper prototypes in its module, including other CasperJS modules, you have to do it inside the CasperJS scope.

As explained on https://github.com/SpookyJS/SpookyJS/wiki/Introduction :

//this is nodejs environement
//declare your spooky instance here
spooky.start('http://example.com/the-page.html');
spooky.then(function () {
    // this function runs in Casper's environment
    //here you can access to mouse module. Example :
    this.mouse.click(400, 300); 
});
spooky.thenEvaluate(function () {
    // this function runs in the page's environment
})
// this function (and the three spooky calls above) runs in Spooky's environment
spooky.run();