I'm trying to write a perl script that will log into a particular site. There is a bug on the site that issues a bogus error (browser does not accept cookies), and username & passwords are cleared. But if I manually re-enter the username and password, my logi is successful.
I'm trying to emulate this behavior in perl by testing for the cookies error after my initial login attempt, I repeat the following:
$mech->set_fields(Username => $username, Password => $password);
$mech->submit();
$output_page = $mech->content();
The resulting behavior is the site responds as if I did not repopulate the username and password fields and simply clicked on the Login button.
During debugging, I discovered that if I invoke the click() method prior to initially populating the username and password fields, they don't get filled in by the set_fields() method.
How can I repopulate fields on the same webpage after invoking the click or submit methods?