I'm having trouble getting buttons to fire on a web page that has several unamed buttons via Mechanize.

1. I tried mech->submit_form() which failed to click the button but correctly updated the form values. (As expected.)

2. Next I tried following the submit_form() by a click_button(number => 3) and when that failed I tried click_button(value => "Save'n Start". Both of these failed to work.

3. So then I tried individually setting the form values via form_number() and 3 field(name,val) follwed by the two click_button calls. Again, no luck and this time the form values were not updated either.

Any ideas?
#!/usr/bin/perl use WWW::Mechanize; ## Automate Grabbing Webpages use strict; ## What URL shall we retrieve? my $url = "http://10.10.10.10/bdtconfig.shtml"; my $mech = WWW::Mechanize->new(autocheck => 1); $mech->default_headers->authorization_basic("user", "pass"); $mech->get($url); my $page = $mech->content; $mech->dump_all(undef, 1); #print $page; my $resp2=$mech->submit_form( form_number => 1, fields => { bdtminvolt => 49.0, bdtmaxtime => 0.3, rect_stby_volt => 45.0 ,}, ); print "Now clicking ...\n"; my $resp3=$mech->click_button(value => "Save'n Start"); #$mech->form_number(1); #$mech->field('bdtminvolt',48.0); #$mech->field('bdtmaxtime',0.2); #$mech->field('rect_stby_volt',45.0); #my $resp3=$mech->click_button(number => 1); #print $resp3->content;
Here is the output, which include a dump_all().
POST http://10.10.3.223/bdtcfg_gen.shtml [bdtForm] <NONAME>=Clear Alarm... (button disabled) <NONAME>=Clear Results... (button) low_volt=52.0 (text) bdtminvolt=49.0 (text) bdtmaxtime=0.2 (text) rect_stby_volt=45.0 (text) very_low_volt=48.0 (text) bdtcycle=13 (text) <NONAME>=3 (option) [*3/Observation|4/Minor|5/ +Major|6/Cr itical] <NONAME>=2 (option) [0/None|1/On Raise|*2/On R + & C|3/On Cease] <NONAME>=2 (option) [0/None|1/On Raise|*2/On R + & C|3/On Cease] <NONAME>=Save No Start (submit) <NONAME>=Save'n Start (submit) <NONAME>=Stop Test (submit) <NONAME>=<UNDEF> (reset) <NONAME>=Factory Default... (button) bdt_event_id=0 (hidden readonly) eid56=117 (hidden readonly) Now clicking ...

In reply to Multiple NONAME buttons and WWW::Mechanize by Anonymous Monk

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.