use strict; use WWW::Mechanize; #use HTTP::Cookies; my $outfile = "out.htm"; my $url = "www.abc.com"; my $username = "usname"; my $password = "passwd"; my $mech = WWW::Mechanize->new(); $mech->get($url); $mech->field(userName => $username); $mech->field(password => $password); $mech->click("button");# Button in first page #Traversed to second page $mech->follow_link("alink");#Successfully completed $mech->click("Button2");#Error my $output_page = $mech->content(); open(OUTFILE, ">$outfile"); print OUTFILE "$output_page"; close(OUTFILE); ####