I am trying to complete the "Acheter un billet" form on this website:
This is my current progress:
var casper = require('casper').create();
casper.start('http://www.leguichet.fr/', function() {
this.fill('form#search_tickets', {'departure':'1', 'arrival':'2'}, false);
this.click('input[value="Rechercher"]');
this.wait(1000, function() {
this.echo(this.getCurrentUrl());
});
});
casper.run(function(){
this.exit();
});
The documentation mentions that fill() uses the value attribute for matching, but I prefer to use the text within the option tags. For example, they have:
<option value="Montpellier">Montpellier</option>
<option value="Béziers">Béziers</option>
So if I want to select Béziers, do I write 'departure':'Montpellier'? Is there a way to utilize the text within the option tags?