in reply to Re^2: https javascript form
in thread https javascript form

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?

Replies are listed 'Best First'.
Re^4: https javascript form
by PerlSufi (Friar) on Jun 12, 2013 at 19:26 UTC
    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
      Yes the field has a name:
      ctl00$MainContent$Login1$Password
      This is the login page:

      http://jyllands-posten.dk/j_spring_openid_security_check?openid_identifier=https://polid.jppol.dk&branding=JPPremLogo

      Wauw, it's really nice of you to take a look at it! Thanks!
Re^4: https javascript form
by PerlSufi (Friar) on Jun 12, 2013 at 21:01 UTC
    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
      I have tried that but it doesn't work :-(

      Could it have something to do with the 'action' field? How do I set that in a form?

Re^4: https javascript form
by PerlSufi (Friar) on Jun 13, 2013 at 14:08 UTC
    See if
     $mech->click_button(value => "Log ind");
    works after you filled in the fields successfully
      Nope. It doesn't work either.

      I have a feeling that it has something to do with the 'action'-url contained in the form. Could that be true? and how do I implement it in my submit_form? I have being searching for examples but haven't found any relevant yet.

        Maybe. You can try  $mech->post($url); I think. If you're willing to use an external browser that interprets javascript, I would take a look at WWW::Mechanize::Firefox or WWW::Selenium