authenticationweb-scrapingautomationphantomjscasperjs

Phantomjs / Casperjs opening bt wifi and login


okay can someone point me in the direction on how i can automate a login to my bt wifi stats and save the resulting HTML into a file

https://www.bt.com/wifi/secure/statuscheck.do

can anybody help me on achieving this i am new to phantom and Casper.

any help and advise will go a long way thanks

error code i am recieveng to answer below

Test file: C:\Users\ash\Downloads\aaaaaaaa\casper\n1k0-casperjs-4f105a9\batchbin\hello.js
FAIL Errors encountered while filling form: form not found
#    type: uncaughtError
#    file: C:\Users\ash\Downloads\aaaaaaaa\casper\n1k0-casperjs-4f105a9\batchbin\hello.js:802
#    error: Errors encountered while filling form: form not found
#           CasperError: Errors encountered while filling form: form not found
#               at fillForm (C:/Users/ash/Downloads/aaaaaaaa/casper/n1k0-casperjs-4f105a9/modules/casper.js:802)
#               at fillNames (C:/Users/ash/Downloads/aaaaaaaa/casper/n1k0-casperjs-4f105a9/modules/casper.js:862)
#               at C:\Users\ash\Downloads\aaaaaaaa\casper\n1k0-casperjs-4f105a9\batchbin\hello.js:5
#               at runStep (C:/Users/ash/Downloads/aaaaaaaa/casper/n1k0-casperjs-4f105a9/modules/casper.js:1553)
#               at checkStep (C:/Users/ash/Downloads/aaaaaaaa/casper/n1k0-casperjs-4f105a9/modules/casper.js:399)
#    stack: not provided


Solution

  • I thin you should use fill and gethtml function:

    Quick program :

    casper.start('https://www.bt.com/wifi/secure/statuscheck.do', function() {
        this.fill('form[name="LoginForm"]', {
           'username': 'LOGIN',
           'password': 'PASS'
        }, true); 
    });
    
    casper.wait(2000, function() {
        this.echo(this.getHTML());
    });
    
    casper.run();