Help, Please: Can't Get a Hold of <input type="button" ...> tag.

--=-gy3YJbQ2zx8x+8PlzCup
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

[[Sorry if this is duplicated. Got an "undeliverable response from the
mailing list on my first post.]]

Listers,

I am new to WWW::Mechanize, and have gotten it to mechanize alot of
point and click stuff, so it's really great. But I cam across a page
that refuses to yeild. I hope someone can help.

I hit a page on the FDIC website that allows me to download Bank
Performance Reports, so-called "Call Reports." I can fill in the fields
on the page, but the button that kicks off the file transfer is
generated by an HTML tag like this:

<input type="button" value="Export" onclick="FormSubmit(this.form);">

I have tried to click it three ways, by specifying the value, the
number, and by just invoking $mech->submit() after selecting into the
form. None of these worked:

1. $mech->click_button(value => 'Export') yeilds "Can't call method
'header' on undefined value." error.

2. $mech->click_button(number => 1) yeilds "Can't call method
'click' on
undefined value." error.

3. $mech->submit() yeilds no error, but no content either.

I poked around in the code, and it looks like HTML::Form is parsing the
<input type="button" ...> tag as a type HTML::Form::IgnoreInput, which
it does very effectively. Apparently, it only counts a <input
type="submit" ...> tag as a button.

Is this right? I'm no HTML expert, but my 1998 O'Reilly book on HTML,
covering HTML 4.0 states that <input type="button" ...> is a synonym for
<button ...>. I would think that HTML::Forms would allow 'click' on the
two variants of button, not just <input type="submit" ...>.

Am I missing something?

My version of HTML::Forms has a version number of 1.44.

I would greatly appreciate any guru-tude you can throw my way.

Thanks.

I've attached the troublesome code this time, in case anyone wants a
look.

--
Dan Doherty
ded-law [at] ddoherty.net
913.402.7336 (Voice)
913.402.7336 (Fax)
913.488.3342 (Mobile)

--=-gy3YJbQ2zx8x+8PlzCup
Content-Disposition: attachment; filename=getcall.pl
Content-Type: application/x-perl; name=getcall.pl
Content-Transfer-Encoding: 7bit

#!/usr/bin/perl -w
use strict;

# Use the mech-dump utiltily to get field and form names
use WWW::Mechanize;

sub getcall {
my $bankno = shift;
my $year = shift;
my $quarter = shift;

my [at] qdates = ('3/31/', '6/30/', '9/30/', '12/31/');
my $qdate .= $qdates[$quarter-1];
$qdate .= $year;
my $mech = WWW::Mechanize->new();
$mech->agent_alias('Windows IE 6');
$mech->get('http://www2.fdic.gov/ubpr/UbprReport/SearchEngin e/Default.asp');
$mech->form_number(3);
$mech->set_fields('txtCert' => $bankno);
$mech->click('btnSubmit');
$mech->form_name('myform');
$mech->set_fields('UBPRTYPE' => 'Stan', 'CustQtrOne' => $qdate);
$mech->click_button(value => 'Generate Report');
# Report Generated
$mech->follow_link(name => 'UpperFrame');
$mech->follow_link(text => 'Export');
print STDERR $mech->content();
$mech->form_name('pageform');
$mech->select('TARGET', 'Tab-Delimited');
$mech->tick('AllPages', "ALL", 1);
#$mech->submit(); # Empty content returned
#$mech->click_button(number => 1); # Can't call method "click" on undefined value
$mech->click_button(value => 'Export'); # Can't call method "header" on undefined value
print STDERR $mech->content();

return 1;
}

getcall(4619, 2002, 3);

--=-gy3YJbQ2zx8x+8PlzCup--
ded-law [ Do, 09 September 2004 04:15 ] [ ID #18691 ]

Re: Help, Please: Can't Get a Hold of <input type="button" ...> tag.

What does the javascript function 'FormSumbit' look like?

--
gedanken
gedanken [ Do, 09 September 2004 15:11 ] [ ID #18694 ]
Perl » perl.libwww » Help, Please: Can't Get a Hold of <input type="button" ...> tag.

Vorheriges Thema: How to simulate https secured login using lwp
Nächstes Thema: passing xml to remote server using lwp