[英]Perl Fill Out Form Based on Element ID
我正在嘗試使用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
});
想通了,不得不使用選擇器
my $field = $mech->selector('input.ssTextboxField', single => 1);
$mech->field( $field => $value );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.