Last active
August 29, 2015 14:15
-
-
Save boulabiar/d935bf82497d5fb91fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create(); | |
casper.start('http://www.bibus.fr/horaires-station-navitia.aspx', function() { | |
this.echo(this.getTitle()); | |
}); | |
casper.run(); | |
// fill form | |
casper.then(function(){ | |
this.evaluate(function() { | |
ee= document.getElementById("ctl00_Centre_UC_Horaires1_ddlLigne"); | |
$(ee).blur(); | |
document.querySelector(".ctrDropDown").selectedIndex = 4; | |
$(".ctrDropDown").change(); | |
setTimeout(function(){ | |
document.querySelector("#ctl00_Centre_UC_Horaires1_ddlDirection").selectedIndex = 2; | |
$("#ctl00_Centre_UC_Horaires1_ddlDirection").change(); | |
document.querySelector("#ctl00_Centre_UC_Horaires1_ddlArret").selectedIndex = 46; | |
$("#ctl00_Centre_UC_Horaires1_ddlArret").change(); | |
setTimeout(function(){ | |
document.getElementById("ctl00_Centre_UC_Horaires1_lbRechercher").click(); | |
}, 100); | |
}, 1000); | |
}); | |
}); | |
// get the time | |
casper.wait(3000, function() { | |
if (this.exists('table')) { | |
this.echo('table exists'); | |
this.echo(this.getElementInfo('table').html); | |
} | |
//this.captureSelector('table.png','table'); | |
this.capture('screenshot.png'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pour automatiser, il suffit d'ajouter une boucle et jouer sur les valeur de selectedIndex
.selectedIndex = valeur ;