[问题] perl mechanize 问题

楼主: gecer (gecer)   2018-02-08 21:35:48
小弟用mechanize 连结url 因此url有两个frame 第一个frame 输入input字串后 submit
后 资料会更新第二个frame 小弟想要下载第二个frame 但是open 2nd frame无法连结
html档如下
url
<frame name="rtop" src="menu.asp" target="rbottom">
<frame name="rbottom" src="home.html" scrolling="auto">
url link 1
<td width=28% align=center><input type="submit" name="act" value="xxx"
class="cbutton">
Code
==============================================================================
#!c:\\perl\\bin
use strict;
use WWW::Mechanize;
my $url = "myurl";
my $Part = 'mykey';
my $outfile1 = "out1.html";
my $mech = WWW::Mechanize->new();
$mech->get($url);
$mech-> follow_link(tag => "frame"); # open first frame in document
$mech-> field ('' => $Part);
$mech-> submit();
$mech-> follow_link(tag => "frame"); # open 2nd frame in document
my $output_page = $mech->content();
open(OUTFILE, ">$outfile1");
print OUTFILE "$output_page";
close(OUTFILE);
==============================================================================

Links booklink

Contact Us: admin [ a t ] ucptt.com