Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: https javascript form

by PerlSufi (Friar)
on Jun 12, 2013 at 15:32 UTC ( #1038500=note: print w/ replies, xml ) Need Help??


in reply to https javascript form

Hi, A couple things:
first: it is perlmonks best practice to enclose your code in the "< code >" "< /code >" parameters (without the spaces between arrows and the word code)
second: why don't you actually try to fill out the form on the page with LWP::UserAgent or WWW::Mechanize? I recently did a tutorial about WWW::Mechanize that explains this. I would personally just 'GET' the login page, fill out the forms and submit them. WWW::Mechanize has this.


Comment on Re: https javascript form
Re^2: https javascript form
by bib (Initiate) on Jun 12, 2013 at 17:24 UTC

    Thank you very much for your reply. It makes perfect sense to follow your tutorial :-)

    Only problem is that my login form has these three javascript input fields:

    <p>name="ctl00$MainContent$Login1$UserName"</p> <p>name="ctl00$MainContent$Login1$Password"</p> <p>name="ctl00$MainContent$Login1$LoginButton"</p>

    and I have no idea how to figure out how they work. I have tried looking at LIVE HTTP Header but the url that I think is relevant only puts the names like this:

    ctl00%24MainContent%24Login1%24UserName=[MYUSERNAME]&ctl00%24MainConte +nt%24Login1%24Password=[MUPASSWORD]&ctl00%24MainContent%24Login1%24re +memberMeCheckbox=on&ctl00%24MainContent%24Login1%24LoginButton=Log+in +d
      Now I have with success filled in the form's username and - I think - all other fields except the password which has no 'value' field. How do i get around that?
        Does the field have a 'name'? 'value' or 'name' can work. I would need to inspect the HTML of the page itself if you can post the login page link, too
        see if this works:
        use WWW::Mechanize; my $usr = "your_username"; my $pw = "your_password"; $mech->form_number(1); $mech->field( "ctl00$MainContent$Login1$UserName", $usr); $mech->form_number(2); $mech->field("ctl00$MainContent$Login1$Password", $pw); $mech->click(); $mech->dump_text; # for debugging
        See if
         $mech->click_button(value => "Log ind");
        works after you filled in the fields successfully

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-12-28 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls