Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

is anyone familiar with this module?
I have a form with a radio button, any idea how do I click on it???

to be more precise,I have an HTML page, with a radio button, and a
submit button, how do I click / set the radio button??? (I managed to
click the submit button...)

Re: WWW::Mechanize

I'm no Mech expert, but.. it is a pretty popular module.

You aren't wasting your time learning how to use it.
So 'perldoc WWW::Mechanize' is your friend...

That said....
Here's one way to choose a radio field value:

# (obviously not production code)
$mech->field('radiogroup_name', 'value you want to set');
$mech->click_button(number => 1);

This assumes you know the radio name, and that the form is the first
one in the page, as well as the submit button being the first button
in the form.  That's a lot of assumptions, but assumptions keep code
simple!  If you need a more general solution, you'll have to do more
inspection by accessing data objects through Mech.

Mech scripts can get prohibitively complicated if you don't know
anything about the HTML you may encounter.


Quoted text here. Click to load it

Site Timeline