2

我正在尝试使用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
});
4

1 回答 1

3

想通了,不得不使用选择器

my $field = $mech->selector('input.ssTextboxField', single => 1);
$mech->field( $field => $value );
于 2015-09-16T20:19:26.113 回答