Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using html::Form to submit a form with different buttons

Status
Not open for further replies.

deeperperl

Programmer
Mar 6, 2011
3
0
0
US
Hello!

I am trying to see how we can automate the submission on a form. I am trying to use HTML::FORM to do this.

I am able to fill out all the values in the form except for one field.

In this field, I am adding the inputs and I need to click on the “Add” button which has no specific name.

I am unable to do this.

Here is a small snippet -

if ($name =~ /^\s*$/ && $input->{type} =~ /button/ && $input->{value} =~ /Add/) {
$input = $forms[0]->find_input( ‘’ );

my $ua = LWP::UserAgent->new;
push @{ $ua->requests_redirectable }, 'POST';
$ua->cookie_jar({ file => "/tmp/mycookie" });
$response = $ua->request($forms[0]->click(''));
$forms[0]->dump;
}

Here is what I see in the dump:
raw_hosts=H1,H2 (text)
<NONAME>=Add (button)


Here are the form details as shown by the web developer form details:

Elements
Index Id Name Type Value Label Size Maximum Length State
0 isXHR text 0
1 Submit1 Submit submit Submit
2 Cancel1 Cancel button Cancel
3 type type select
4 property property select
5 where where[] select 4
6 macro macro
7 raw_hosts raw_hosts text
8 button Add <-- This is where I am having a problem.
9 hosts hosts select 5
10 desc desc textarea
11 who who select
12 cc cc text
13 Submit2 Submit submit Submit
14 Cancel2 Cancel button Cancel

Appreciate any help in this regard.

- Shekar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top