我使用 WWW::Mechanize::Shell 来测试东西。
我的代码是这样的:
#!/usr/bin/perl
use WWW::Mechanize;
use HTTP::Cookies;
my $url = "http://mysite/app/login.jsp";
my $username = "username";
my $password = "asdfasdf";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_number(1);
$mech->field(j_username => $username);
$mech->field(j_password => $password);
$mech->click();
$mech->follow_link(text => "LINK A", n => 1);
$mech->follow_link(text => "LINK B", n => 1);
…………………………………………………………………………………………………………………………………………………………………………………… …………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………等等
问题是下一个:
LINK B (web_page_b.html),重定向到 web_page_x.html
如果我打印 $mech->content() 的内容,则显示 web_page_b.html
但我需要显示 web_page_x.html,以自动提交 HTML 表单(web_page_x.html)
问题是:
我怎样才能得到 web_page_x.html ?
谢谢