Subject: | agent->request |
I needed to visit URL http://blah.com/aaa.asp
wherein based on selection of a radio button, the action
will be set to http://blah.com/bbb.asp (using JavaScript).
Using WWW::Mechanize, here is what I had to do:
$agent->get('http://blah.com/aaa.asp')->is_success or die;
$agent->form(1) or die;
my $f = $agent->current_form();
$f->action('http://blah.com/bbb.asp');
$f->value('UserName', '...');
$f->value('Password', '...');
$response = $agent->request($f->click());
$response->is_success or die;
$content1 = $agent->content();
$content2 = $response->content()
$content1 is stale and $content2 is the correct one.
Is the code outlined (using $content2) the right approach?
I expected $agent->content() was same as $response->content()