I have a bunch of webpages I would like to navigate through a script and grab all the contents of. I know the link is the 18th link on every page. I have the following code as a test to just follow the link once and screen scrape:
use strict;
use WWW::Mechanize;
my $start = "http://*some-webpage*";
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get( $start );
open(Output, ">mech_test.txt") or die $!;
$mech->follow_link(url_regex => qr//, n => 18 );
print Output $mech->response()->content();
close(Output);
Unfortunately the link I am trying to access has nothing in the href tag. Viewing source of the page the links looks like this:
<a href="" onclick="return _doClick('CA256D6E001A7020.80376e858b0791b1ca256d7300098304/$Body/0.155A', this, null)">Next >></a>
I believe this is javascript and there is no way mechanize can follow this link. Any ideas to get around this?