[英]WWW::Mechanize::Firefox put content into input by id
I am using WWW::Mechanize::Firefox. 我正在使用WWW :: Mechanize :: Firefox。 How to put content into input by id and after that to press link witch, using JS, submit page?
如何使用id将内容输入到内容中,然后使用JS按链接巫婆,提交页面?
<input id="my_input" type="text" class="some_class"/>
<a id="send_with_me" href="#">Press me</a>
How to do it? 怎么做?
Thanks 谢谢
Answer to request of Borodin: 回答鲍罗丁的要求:
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
I want to put value into input by id. 我想通过id将值输入。 Something like this:
像这样:
$mech->field("#my_input", 100);
$mech->some_method_witch_press_href("#send_with_me");
You need this to click the link (by CSS selector): 您需要使用它来单击链接(通过CSS选择器):
$mech->field("#my_input", 100);
$mech->click({ selector => '#some_id' });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.