Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^8: javascript login

by robertw (Sexton)
on Aug 17, 2012 at 19:21 UTC ( #988074=note: print w/ replies, xml ) Need Help??


in reply to Re^7: javascript login
in thread javascript login

I put strict off and it gives no errors, then i ran it and it gave line 6 unknown agent 'firefox' and line 1900 of mechanize.pm says there is no form numbered 2, How can i resolve the first error and where does it say the form of html? sorry I am slow in this but I appreciate your help very much:)

my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Firefox' ); $userid = "usr"; $password = "password"; $mech->get( "https://login.binck.nl/klanten/Login.aspx?ReturnUrl=%2fkl +anten%2fdefault.aspx" ); $mech->submit_form( form_number => 2, fields => { userid => "$userid", password => "$password" }, button => "btnSignon" );


Comment on Re^8: javascript login
Download Code
Re^9: javascript login
by aitap (Deacon) on Aug 17, 2012 at 19:43 UTC

    I put strict off and it gives no errors,
    It is recommended to put it back on and declare variables properly.

    then i ran it and it gave line 6 unknown agent 'firefox'
    This is because there is no agent alias called "Firefox". Use known_agent_aliases() to get available names, for example:
    $ perl -MWWW::Mechanize -E'say join ", ",WWW::Mechanize::known_agent_a +liases' Linux Konqueror, Linux Mozilla, Mac Mozilla, Mac Safari, Windows IE 6, + Windows Mozilla

    and line 1900 of mechanize.pm says there is no form numbered 2
    Try using Data::Dumper and forms() method to get the list of forms available for WWW::Mechanize.

    Sorry if my advice was wrong.
      Or just $mech->dump_forms;
        mechanize.pm gives an error because when i
        $mech->dump_forms( ["https://login.binck.nl/klanten/Login.aspx?ReturnU +rl=%2fklanten%2fdefault.aspx"] );
        Mechanize.pm:2128: Not a GLOB reference # print {$fh} $form->dump, "\n"; gives an error sub dump_forms { my $self = shift; my $fh = shift || \*STDOUT; for my $form ( $self->forms ) { print {$fh} $form->dump, "\n"; } return; }
         $mech->dump_forms( ["https://login.binck.nl/klanten/Login.aspx?ReturnUrl=%2fklanten%2fdefault.aspx"] );

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://988074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-09-15 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls