首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用WWW::Mechanize::Firefox使用onclick

使用WWW::Mechanize::Firefox使用onclick
EN

Stack Overflow用户
提问于 2013-10-07 21:22:08
回答 1查看 621关注 0票数 1

我需要能够跟踪点击一个网页。这是我到目前为止的密码。

代码语言:javascript
复制
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....
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-08 01:58:35

代码语言:javascript
复制
# 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";

文档在提出这个问题上非常有帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19235022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档