Is there any way to move the jQuery UI – Slider with CasperJS ?
I also found this github issue while searching for a possibility to just click on the left or right of the slider to move the handle. But this doesn't worked for me as well.
Any idea?
Is there any way to move the jQuery UI – Slider with CasperJS ?
I also found this github issue while searching for a possibility to just click on the left or right of the slider to move the handle. But this doesn't worked for me as well.
Any idea?
To move the slider works as follows:
casper.mouse.down(100,100);
casper.mouse.move(200,200);
casper.mouse.up(200,200);
with
casper.capture('test1.jpg');
called before and after the three mouse lines you should see the differene.
This is a complete demo:
// test_slider.js
var casper = require('casper').create(),
mouse = require('mouse').create(casper),
utils = require('utils');
casper.start('http://jqueryui.com/resources/demos/slider/default.html')
.then(function() {
var slider = this.getElementBounds('.ui-slider');
var handle = this.getElementBounds('.ui-slider-handle');
this.echo('=== BEFORE ===', 'INFO');
this.echo(this.getElementAttribute('.ui-slider-handle', 'style'));
this.capture('before.png');
this.echo('=== DRAGGING ===', 'INFO');
this.mouse.down('.ui-slider-handle');
this.mouse.move(slider.left + slider.width / 2, slider.top + slider.height / 2);
this.mouse.up('.ui-slider-handle');
this.echo('=== AFTER ===', 'INFO');
this.echo(this.getElementAttribute('.ui-slider-handle', 'style'));
this.capture('after.png');
})
.run();
$ casperjs test_slider.js
=== BEFORE ===
left: 0%;
=== DRAGGING ===
=== AFTER ===
left: 50%;