2
我试图使用登录到网站下面的代码Perl的机械化follow_link失败
my $mech = WWW::Mechanize->new(autosave=>1);
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->follow_link(text => 'Sign In');
$mech->click();
$mech->field(UserName => "$username");
$mech->field(Password => "$password");
$mech->submit();
但在follow_link在href包含两个前斜线如(//test/sso-login
),因此follow_link正在考虑它作为整个URL和它的失败如下
Error GETing http://test/sso-login: Can't connect to test:80 (Bad hostname)
我不能改变href,因为它是我的控制权。有没有办法来克服这个问题,并使其完整的URL附加这个href。