Javascript 在下拉表单Perl中输入值
我正在尝试编写一个perl脚本,它使用perl和WWW::Mechanize::Firefox包在网页的下拉框中输入一个值。下面是webapge源的一部分,其中包含我试图输入的内容Javascript 在下拉表单Perl中输入值,javascript,perl,firefox,mechanize,enter,Javascript,Perl,Firefox,Mechanize,Enter,我正在尝试编写一个perl脚本,它使用perl和WWW::Mechanize::Firefox包在网页的下拉框中输入一个值。下面是webapge源的一部分,其中包含我试图输入的内容 <div class="exp-pdp-size-and-quantity-container"> <div class="exp-pdp-size-container exp-pdp-dropdown-container nsg-form--drop-dow
<div class="exp-pdp-size-and-quantity-container">
<div
class="exp-pdp-size-container exp-pdp-dropdown-container nsg-form--drop-down">
<a class="nsg-form--drop-down--label nsg-font-family--platform" >
<span class="js-selectBox-label">SIZE </span>
<span class="js-selectBox-value nsg-form--drop-down--selected-option"></span>
</a>
<select name="skuAndSize"
class="exp-pdp-size-dropdown exp-pdp-dropdown two-column-dropdown"
data-tooltiptext="Select a Size" required="required"
data-error="Select a Size" >
<option class="exp-pdp-size-not-in-stock" value=""></option>
<option
name="skuId"
value="3613869:5"
data-label="(5)">
5
</option>
它的返回基本上是说skuAndSize
不存在。
这是网站的url
有人能帮我在我认为的
skuAndSize
中输入一个值吗?感谢有人能帮我解决这个问题或帮我找到正确的方向。Brett是否显示您的代码?至少不工作的部分我在帖子中添加了我的不工作代码,我想你会发现表单编号应该是6。此外,没有名为“添加到购物车”的按钮,这只是文本内容代码>至$mech->表格编号(6)代码>保持不变,一切照旧还是不起作用。我应该再做些改变吗?把我之前说的话记下来,改变一下,它现在似乎起作用了,玩弄一下我如何调用skuAndSize
,它现在似乎起作用了。谢谢
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new();
$mech->get($url);
$mech->form_number( 1 );
$mech->select( "skuAndSize", $shoesize );
$mech->click( "ADD TO CART" );