in reply to Re^2: How do I pull HTML form option values?
in thread How do I pull HTML form option values?

From what I can tell, WWW::Mechanize uses HTML::Form, which , in my opinion, does not parse the <select> tag properly.

The code looks for "multiple":

if (exists $self->{multiple}) { unshift(@{$self->{menu}}, { value => undef, name => "off"} +); $self->{current} = $checked ? 1 : 0; } else { $self->{current} = 0 if $
which does not seem to be set anywhere.
As a result, it only pickes up the first <option>.

You will likely have to parse the raw html using HTML::TokeParser or the like, to extract the options.

See fellow un-answered sufferer at stackoverflow.

                Memory fault   --   brain fried

Replies are listed 'Best First'.
Re^4: How do I pull HTML form option values?
by beech (Parson) on Apr 04, 2018 at 21:55 UTC

    From what I can tell, WWW::Mechanize uses HTML::Form, which , in my opinion, does not parse the <select> tag properly. ... excerpt from source code

    Hi,

    I doubt rt://HTML-Form has issue with select tag.

    On the aforementioned website, the distances in miles are provided by javascript.

    HTML::Form, like WWW::Mechanize, doesn't run javascript. For that you'd need WWW::Mechanize::Firefox /..::Chrome/..::PhantomJS

      You are right ! (++)

      The select has an event listener that somehow manages to populate the distance options .. although I could hot figure out how it did that.

      In my debug attempt, I did an "inspect" of the option, and saw the options populated, so I assumed they came from HTML.

      Thanks for identifying the issue!

                      Memory fault   --   brain fried

        Hi,

        I used mech-dump to dump the forms on the page