When trying to select form with form_number 2, the error message is "No elements found for form number 2".

Both these error messages including "4 elements found for form number 1" leads to quit the program based on the value of the parameter autodie which is set to 1 by default.

Even if I turned off autodie, the value function does not return the present value when the error is "4 elements found for form number 1". Please see below for the code snippet and output for the same:

my $input_name = 'DMPName'; my $web_url = 'http://xxx.xxx.xx.xx/config.asp'; my $mech = WWW::Mechanize::Firefox->new(activate => 0, autoclose => 1, autodie =>0); $mech->get($web_url, no_cache => 1); $current_form = $mech->form_number(1); print "Present value of $input_name: " . $mech->value($input_name) . " +\n";
Output:
4 elements found for form number 1 at ..... No elements found for input with name 'DMPName' at .... Present value of DMPName:
But interestingly while selected the form 10 which is not existing, I got following output:
$current_form = $mech->form_number(10);
No elements found for form number 10 at ... Present value of DMPName: Current Name

In reply to Re^8: Not able to select the form with WWW::Mechanize::Firefox using form_with_fields() by ajose
in thread Not able to select the form with WWW::Mechanize::Firefox using form_with_fields() by ajose

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.