我正在编写一个脚本来选择尺寸并将产品添加到购物车这里是 http://store.nike.com/us/en_us/pd/free-4-flyknit-running-shoe/pid-1064825 /pgid-1481072
use WWW::Mechanize::Firefox;
$mech = WWW::Mechanize::Firefox->new();
my $tconike = "http://store.nike.com/us/en_us/pd/free-4-flyknit-running-shoe/pid-1064825/pgid-1481072";
$mech->get($tconike);
print $mech->uri();
$mech->submit_form(
form_number=> 2,
fields => {
skuAndSize => $shoesize,
click => "ADD TO CART",
}
);
但这是输出
Uncaught exception from user code:
No form found to submit. at nikecartstandalone.pl line 25
at C:/Users/Brett/Documents/brett/Perl/perl/site/lib/WWW/Mechanize/Firefox.pm l
ine 2162
WWW::Mechanize::Firefox::signal_condition('WWW::Mechanize::Firefox=HASH(
0x2a54888)', 'No form found to submit.') called at C:/Users/Brett/Documents/bret
t/Perl/perl/site/lib/WWW/Mechanize/Firefox.pm line 3649
WWW::Mechanize::Firefox::submit_form('WWW::Mechanize::Firefox=HASH(0x2a5
4888)', 'form_number', 2, 'fields', 'HASH(0x3501328)') called at nikecartstandal
one.pl line 25
任何人都知道我做错了什么,是因为我应该使用其他东西submit_form
还是其他东西?