【发布时间】:2013-04-12 12:29:53
【问题描述】:
您好,我正在使用循环到get 各个页面。
代码:
while($stm->fetch()) {
$mech->get(**#TheURL**);
$mech->select( 'this', 'that' );
$mech->tick( 'this' => undef );
$mech->tick( 'this' => undef );
$mech->tick( 'this' => undef );
$mech->tick( 'this' => undef );
my $button = $mech->selector('input.button', single => 1);
$mech->click($csvbutton);
}
上面的代码在点击按钮后下载文件。但是它会在第一次迭代后停止。
我已更改 Firefox 的配置以禁用下载管理器弹出窗口。
我收到过一次这个错误:
MozRepl::RemoteObject::Object has no function addProgressListener at `$mech->get(**#TheURL**);`
我们将不胜感激。谢谢。
更新:
我发现它在第一次下载时卡住了,因为 WWW::Mechanize::Firefox 正在等待它没有得到的响应或回发。刚刚下载了一个文件。
$mech->click($csvbutton);
这是它停止的地方。如果我手动操作页面(即返回或转到主页或新 URL),它将继续循环。所以它正在等待新的页面加载。
我如何告诉 WWW::Mechanize::Firefox 不要等待响应或新页面加载?
谢谢
【问题讨论】:
标签: perl web-scraping www-mechanize mozrepl www-mechanize-firefox