我需要能够跟踪点击一个网页。这是我到目前为止的密码。
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....发布于 2013-10-08 01:58:35
# 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_title\n";文档在提出这个问题上非常有帮助。
https://stackoverflow.com/questions/19235022
复制相似问题