libwww-perl / WWW-Mechanize

Handy web browsing in a Perl object
https://metacpan.org/pod/WWW::Mechanize
Other
68 stars 52 forks source link

click_button does not validate arguments as advertised #303

Closed oalders closed 3 years ago

oalders commented 4 years ago

The docs state that click_button():

Has the effect of clicking a button on the current form by specifying its name, value, or index. Its arguments are a list of key/value pairs. Only one of name, number, input or value must be specified in the keys.

However, something like ->click_button(name => 'foo', value => 'bar' ) will be run without complaints and can lead to confusing results.

We should enforce the advertised limits on what this method accepts as valid input.

andyjack commented 4 years ago

I believe the docs could use a tweak as well so that all of the allowed args are mentioned in the "Has the effect" para. id is never mentioned although it is in the list that follows. name, value, or index doesn't mention a few of the possible keys and index might mean number now.