我有以下代码:
$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中做了什么,并没有真正打开浏览器。 (BTW有没有办法用WWW :: Mechanize打开浏览器,看看实际上是怎么回事?)
答案 0 :(得分:3)
请提供一些详细信息,了解其如何
不起作用
要截取屏幕截图,您可以使用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