in reply to Cannot re-enter username, password into login form

How can I repopulate fields on the same webpage after invoking the click or submit methods? <?i>

As documented?

What module are you using? What website are you visiting?

  • Comment on Re: Cannot re-enter username, password into login form

Replies are listed 'Best First'.
Re^2: Cannot re-enter username, password into login form
by GlassKnees (Initiate) on Aug 02, 2014 at 00:44 UTC
    I'm using WWW::Mechanize

    Here is a snippet of code:
    $mech->get($url); $mech->form_name('loginform'); $mech->set_fields(user_login => $username, user_pass => $password); $mech->click(); my $output_page = $mech->content(); if ($output_page =~ m/cookies/) { $TestStatus = 1; ok( $TestStatus , "Login failed - Browser not enabled to accept co +okies error"); # Try logging in again - should work this time... $mech->get($url); $mech->form_name('loginform'); $mech->set_fields(user_login => $username, user_pass => $password); $mech->click(); }

    The first attempt fails and I get the cookies error, which tells me that I'm populating the user_login and user_pass fields. But after invoking the click method, I can't seem to repopulate the fields - at least that's how the site is behaving...