我需要能够关注网页上的点击。这是我到目前为止的代码。
use strict;
use warnings;
use WWW::Mechanize::Firefox;
# Create a new instance of Mechanize
my $mech = WWW::Mechanize::Firefox->new();
# Go to page
$mech->get('http://www.website.com');
# TODO
# use a buttons onclick somehow....
# Go to page
$mech->get('http://www.google.com');
# Fill in the query box
$mech->field( q => "turtles" );
# Click the Feeling Lucky Button
$mech->click( { xpath => '//button[@name="btnI"]' } );
# Get the title of the result page
my $page_title = $mech->title();
print "$page_titlen";
该文档在提出这一点方面非常有帮助。