I have a webpage with 3 frames. The first frame has a form and when the form is submitted, the second frame loads some data. I need to be able to read the data in the second frame. What I have so far is this,
# Use WWW::Mechanize to download webpage
my $mechanize = WWW::Mechanize->new(
noproxy => 0,
stack_depth => 5,
autocheck => 1
);
$mechanize->proxy( https => undef );
my @frames;
eval{
my $me=$mechanize->get('link');
$me->is_success or die $me->status_line;
@frames = $mechanize->find_link( 'tag' => 'frame' ); # three frames
$me=$mechanize->get($frames[0]->url);
$me->is_success or die $me->status_line;
};
my $rb_value = 2000;
my $dt = '06/30/2011'
$mechanize->set_fields(
'idxevent' => $rb_value,
'mindate' => $dt
);
$mechanize->submit();
Now I need to retrieve the content of the second frame. What can I do for this?
Don’t bother with the frameset, get the url of the frame holding the form directly and submit it. Get the result of $mechanize->submit() in a variable, and then you can access it by calling the content() method:
Mechanize does not care about the frameset and the submit target, it just gets the reply from the server so the same will apply for a normal frame-less layout.
You can find an example here