Skip to content

Instantly share code, notes, and snippets.

@boulabiar
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save boulabiar/d935bf82497d5fb91fb8 to your computer and use it in GitHub Desktop.

Select an option

Save boulabiar/d935bf82497d5fb91fb8 to your computer and use it in GitHub Desktop.

Revisions

  1. boulabiar revised this gist Feb 25, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions BibusFetcher
    Original file line number Diff line number Diff line change
    @@ -21,10 +21,11 @@ casper.then(function(){
    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();
    setTimeout(function(){
    document.getElementById("ctl00_Centre_UC_Horaires1_lbRechercher").click();
    }, 100);
    }, 1000);

    });
    });

  2. boulabiar created this gist Feb 18, 2015.
    39 changes: 39 additions & 0 deletions BibusFetcher
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    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');
    });