我正在尝试使用WWW::Mechanize
填写表单。不幸的是我的页面需要JS,所以我现在使用WWW::Mechanize::Firefox
。
这是我要填写的元素。
<input id="ember745" class="ssTextboxField"></input>
set_field()函数采用元素名称。我如何给它一个元素ID(ember 745)并填写表格?
到目前为止,这是我的代码
use WWW::Mechanize::Firefox;
my $mech = WWW::Mechanize::Firefox->new(autoclose => 0);
$mech->get(URL);
$mech->form_number(1);
$mech->submit_form(
fields => {
ember745 => $value
});
答案 0 :(得分:3)
想出来,必须使用选择器
my $field = $mech->selector('input.ssTextboxField', single => 1);
$mech->field( $field => $value );