[英]Downloads in Firefox using Perl WWW::Mechanize::Firefox
[英]using WWW::Mechanize::Firefox to use an onclick
我需要能夠跟蹤網頁上的onclick。 這是我到目前為止的代碼。
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_title\n";
該文檔對於解決此問題非常有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.