Perl提交到一个页面,然后再次提交

Perl提交到一个页面,然后再次提交,perl,Perl,我有以下代码: $IEDocument = $IE->{Document}; $Forms = $IEDocument->all; $form = $forms->item{'search'); $form->click; # it clicks the search button which submits to a page # then I do the following $doc = $IE->{Document}; #Not sure if corr

我有以下代码:

$IEDocument = $IE->{Document};
$Forms = $IEDocument->all;
$form = $forms->item{'search');
$form->click;

# it clicks the search button which submits to a page
# then I do the following

$doc = $IE->{Document}; #Not sure if correct
$forms = $doc->{DocumentElement}->{InnerHTML};
$form = $forms->item('field');
$form->{value} = "12345";

# The following code must submit to a page, then put new info in an input field on that new submitted page

但它不起作用,有什么办法?我做了很多研究,有人建议使用WWW::Mechanize,但当我使用它时,我无法拍摄页面的截图,因为Mechanize只显示它在CMD中的作用,并没有真正打开浏览器。(顺便问一下,有没有办法用WWW::Mechanize打开浏览器,看看到底是怎么回事?

请提供一些详细信息

不起作用

要拍摄屏幕截图,您可以使用WWW::Mechanize::Firefox模块:

use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
$mech->get('http://google.com');

my $png = $mech->content_as_png(); #you have a screen in $png now

为什么你需要截图?我需要一张它提交给我的页面上的图片。这真的很好,但我想要屏幕的某个部分,而不是整个屏幕。使用WWW::Mechanize也可以这样做吗?另外,要安装`WWW::Mechanize::Firefox`我是否要执行
cpan WWW::Mechanize::Firefox
另外,这是否会打开浏览器并执行任何操作?或者它是在CMD中实现的(用词不太好)对不起,我说的“屏幕”是指只有目标站点的屏幕截图。你说的“某些部分”是什么意思?您还需要
cpan安装WWW::Mechanize::Firefox
。安装后,您需要对Firefox(安装Mozrepl插件)进行一些调整。假设我想从100x100坐标开始截图300x300像素。Grigor,这有助于提高您正在使用的软件的质量。