rembrantxvii has asked for the wisdom of the Perl Monks concerning the following question:
My mechanize script then goes and grabs the webpage:<html> <form> <button type="submit" id="test" name="test">My Button</button> </form> </html>
Mechanize then gives an error 'no clickable input with name test'. Dumper shows the form was located correctly, but that it contained no items.use WWW::Mechanize; use Data::Dumper; # URL to retrieve $url = 'http://myurl.html '; # Create an instance of Mechanize to scrape my $mechanize= WWW::Mechanize->new( autocheck => 1 ); # Grab the form $mechanize->get($url); $mechanize->form_number('1'); ($output) = $mechanize->current_form(); open(FH, '>dump.txt'); print FH Dumper($output); close(FH); $mechanize->click_button(name => 'test');
However, if I modify that original HTML code snippet to say <input type="submit></input> rather than <button>, Mechanize will successfully run the click_button() routine and Dumper shows that the form contained an HTML::Form::SubmitInput object.
How can I click on buttons then that are of the form <button type="submit"> or even find those buttons on the page? From the dump, it seems like Mechanize ignores them all together. Am I mistaking the functionality of click_button()? Click() may work for a single case, but when there are multiple buttons on a page, I need click_button().
Any help is appreciated.
-- RembrantXVII
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize click_button
by Limbic~Region (Chancellor) on Jan 23, 2008 at 20:23 UTC | |
|
Re: WWW::Mechanize click_button
by talexb (Chancellor) on Jan 23, 2008 at 20:59 UTC | |
by erik (Sexton) on Jan 24, 2008 at 09:59 UTC | |
|
Re: WWW::Mechanize click_button
by amarquis (Curate) on Jan 23, 2008 at 20:17 UTC | |
by talexb (Chancellor) on Jan 23, 2008 at 21:04 UTC | |
by Limbic~Region (Chancellor) on Jan 23, 2008 at 21:23 UTC | |
by Limbic~Region (Chancellor) on Jan 23, 2008 at 20:47 UTC | |
by amarquis (Curate) on Jan 24, 2008 at 14:19 UTC | |
|
Re: WWW::Mechanize click_button
by Popcorn Dave (Abbot) on Jan 23, 2008 at 20:15 UTC | |
|
Re: WWW::Mechanize click_button
by roweco (Initiate) on Jan 24, 2008 at 14:38 UTC |