Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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?Here is the output, which include a dump_all().#!/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;
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 ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple NONAME buttons and WWW::Mechanize
by almut (Canon) on Feb 06, 2010 at 00:36 UTC | |
by Anonymous Monk on Feb 06, 2010 at 03:32 UTC | |
by blakew (Monk) on Feb 07, 2010 at 16:53 UTC | |
by dneedles (Sexton) on Feb 06, 2010 at 04:07 UTC | |
by dneedles (Sexton) on Feb 06, 2010 at 06:04 UTC | |
by dneedles (Sexton) on Feb 08, 2010 at 22:51 UTC | |
by Anonymous Monk on Feb 01, 2011 at 14:23 UTC | |
by Corion (Patriarch) on Feb 01, 2011 at 14:26 UTC |