I'm trying to get WWW::Mechanize to find a button on a page and click it, but the click_button() function doesn't seem to work properly.
For a test example, consider the following website:
<button type="submit" id="test" name="test">My Button</button>
My mechanize script then goes and grabs the webpage:
# URL to retrieve
$url = 'http://myurl.html ';
# Create an instance of Mechanize to scrape
my $mechanize= WWW::Mechanize->new( autocheck => 1 );
# Grab the form
($output) = $mechanize->current_form();
print FH Dumper($output);
$mechanize->click_button(name => 'test');
Mechanize then gives an error 'no clickable input with name test'. Dumper shows the form was located correctly, but that it contained no items.
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.