my @inputs = $mech->find_all_inputs(
type => 'image',
name_regex => qr/$pattern1/,
);
#the Pattern is simply a name that is unique to all the buttons I want to access
foreach my $i(@inputs){
my $temp = $i->name();
$mech->click_button(name => $temp);
$tempContent = $mech->content;
&getDetails($tempContent); # this is another function using tokeparser to grab info from the page linked by the images content
$goToMoreDetails = $mech->uri();#variable to grab the current url, for future use.
$mech->back(); #returning to original page.
}
####
####
my $resp = $mech->response();
my $root = HTML::TreeBuilder->new_from_content( $resp->content );
#The next part is to grab the link element, it is a hack job, I wasn't able to get both tag-> a and title eq 'Next Page' in one line, which would be cleaner.
my @a_tags = $root->look_down( '_tag' , 'a' );
foreach my $atag(@a_tags){
my $temp = $atag->as_HTML;
if($temp =~ 'title="Next Page"'){
$a = $atag;
}
}
#This is code from the CPAN website for the module
#It was noted to use an ->httpResponse, which doesn't exist
#Since the response is the result of the request I have replaced it with
my $aspnet = HTML::TreeBuilderX::ASP_NET->new({
element => $a
, baseURL =>$mech->uri ## takes into account posting redirects
});
my $response = $mech->request($aspnet->httpRequest);
my $content = $response->content;
print $content;
# I wanted to see if I got the proper html content
####
my $content = $mech->get($aspnet->httpRequest->as_string);
print $content;