http://www.perlmonks.org?node_id=900338


in reply to Re: click radio button with WWW::Mechanize
in thread click radio button with WWW::Mechanize

I just found this very old node by doing some searches on PM regarding a similar problem with mechanize.

Funny thing is, that whilst the answer above does address the issue at hand (and also proves the laziness of people towards searching before asking), none of the listed nodes above actually provide any clear and simple answer as to the questions posted by any of the OPs!

Anyway, I found it quite funny and peculiar, so here is the clear and simple answer:

In WWW::Mechanize radio buttons can be set just like you would set any regular text input field, but you must know the exact value of the radio button you want to select beforehand. They don't work like selects and they don't work by clicking. See examples below:

# this 'clicks' the $rb_value button in rb_name group $mech->set_fields( rb_name => $rb_value, ); # this will work as well $mech->submit_form( form_number => 1, fields => { rb_name => $rb_value, }, );