簡體   English   中英

WWW :: Mechanize :: Firefox將ID內容輸入

[英]WWW::Mechanize::Firefox put content into input by id

我正在使用WWW :: Mechanize :: Firefox。 如何使用id將內容輸入到內容中,然后使用JS按鏈接巫婆,提交頁面?

<input id="my_input" type="text" class="some_class"/>
<a id="send_with_me" href="#">Press me</a>

怎么做?

謝謝

回答鮑羅丁的要求:

my $mech = WWW::Mechanize::Firefox->new(
    activate => 1
);

my $content = $mech->get("http://some_url.com");
$mech->field(".my_select_element_by_class", 1); #select element from select by class

我想通過id將值輸入。 像這樣:

$mech->field("#my_input", 100);
$mech->some_method_witch_press_href("#send_with_me");

您需要使用它來單擊鏈接(通過CSS選擇器):

$mech->field("#my_input", 100);
$mech->click({ selector => '#some_id' });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM