Mouse module not documented. Deprecated ?

139 views
Skip to first unread message

Joe List

unread,
Sep 19, 2012, 9:13:39 AM9/19/12
to casp...@googlegroups.com
Hi,

I just discover in the samples/bbcshots.js the use of:

[code]
this.mouse.move("#promo2_carousel");
[/code]

but it's not documented on the casperjs website

I try to use it and it works good with this real example:

[code]
var casper = require('casper').create({
  viewportSize: {width: 970, height: 600}
});
casper.then(function() {
  this.mouse.move('li.first a');
  this.wait(500, function() {
    this.capture('capture-mouse-move.png');
  });
});
casper.run();
[/code]

I first think that it's not documented because it's deprecated and replaced by the mouseEvent method.

But if I use it in my real example, the result is no more the same. The rollover seems not performed on the page.

[code]
var casper = require('casper').create({
  viewportSize: {width: 970, height: 600}
});
casper.then(function() {
  this.mouseEvent('mousemove', 'li.first a');
  this.wait(500, function() {
    this.capture('capture-mouve-event.png');
  });
});
casper.run();
[/code]

So, my questions are simple:
- casper.mouse.move() is deprecated ?
- casper.mouseEvent('mousemove') is really equals to casper.mouse.move() ?

Thanks

Nicolas Perriault

unread,
Sep 19, 2012, 9:49:33 AM9/19/12
to casp...@googlegroups.com
On Wed, Sep 19, 2012 at 3:13 PM, Joe List <triba...@gmail.com> wrote:

> So, my questions are simple:
> - casper.mouse.move() is deprecated ?

Nope, just undocumented.

> - casper.mouseEvent('mousemove') is really equals to casper.mouse.move() ?

Theoretically yes, but if it's not feel free to file a bug with a
reduced test case

++

--
Nicolas Perriault
https://nicolas.perriault.net/http://www.akei.com/
Skype: nperriault
Phone: +33 (0) 660 92 08 67

Joe List

unread,
Sep 19, 2012, 11:17:43 AM9/19/12
to casp...@googlegroups.com
Thanks Nico for the infos !

Jonathan Langevin

unread,
Feb 27, 2015, 3:28:46 PM2/27/15
to casp...@googlegroups.com
Looking at the CasperJS source, casper.mouseEvent() triggers a JS mouse event, whereas Casper.mouse will send events to the PhantomJS page, as user input.
So Casper.mouse would (theoretically?) act more like a real mouse would.
Reply all
Reply to author
Forward
0 new messages