perlwww-mechanize-firefox

WWW::Mechanize::Firefox put content into input by id


I am using WWW::Mechanize::Firefox. How to put content into input by id and after that to press link witch, using JS, submit page?

<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. Something like this:

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

Solution

  • You need this to click the link (by CSS selector):

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