我正在使用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");
答案 0 :(得分:0)
您需要点击链接(通过CSS选择器):
$mech->field("#my_input", 100);
$mech->click({ selector => '#some_id' });