On Jul 9, 11:35 am, [EMAIL PROTECTED] (Scbauer) wrote:
> Im currently trying to get all the options with in a <Select> </
> Select> selected using WWW::Mechanize with no luck. Any ideas?

You want the possible_values() method of the form in question.
Observe:

$ cat select.html
<html>
<head>
  <title>Sample file</title>
</head>
<body>
<form action="http://www.example.com/submit.cgi"; method="post">
  <input type="text" name="alpha">
  <select name="menu">
    <option value="one">1</option>
    <option value="two">2</option>
    <option value="three">3</option>
  </select>
  <input type="submit" name="submit" value="Do it">
</form>
</body>
</html>


$ perl -MWWW::Mechanize -le'
my $mech = WWW::Mechanize->new();
$mech->get("file:select.html");
my ($form) = $mech->forms();
my $menu = $form->find_input("menu");
print for $menu->possible_values();
'
one
two
three

Hope this helps,
Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to