Skip to content

Instantly share code, notes, and snippets.

@JohnnyQQQQ
Last active December 12, 2015 09:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JohnnyQQQQ/4751813 to your computer and use it in GitHub Desktop.
Save JohnnyQQQQ/4751813 to your computer and use it in GitHub Desktop.
simple snippet and demo for a drag and drop motion in casperjs
var casper = require('casper').create();
casper.start();
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');
casper.viewport(1024, 768);
casper.thenOpen('http://jsbin.com/ifuma#noedit', function() {
this.capture('test.png');
this.mouse.down(10, 10);
this.mouse.move(200, 200);
this.mouse.up(200, 200);
this.capture('test1.png');
});
casper.run();
@n1k0
Copy link

n1k0 commented Feb 11, 2013

Simple question, did you need to set the UA to Mozilla/5.0 (Macintosh; Intel Mac OS X) to make it work?

@JohnnyQQQQ
Copy link
Author

I only tested it for now with this UA, without setting the UA it's not working so far ,...

Just made a test with a few other UA, working so far..

@riksof-rehan
Copy link

Is it use to drag the windows size, I am trying this but it is not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment