lazybowel has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to use mechanize to fill out a form on a site however one part of the form the Birthdate is a javascript drop down menu. Since mechanize doesnt support java i was wondering how i could go around this. I read that i would need to get the function out of the java code. How can i do this?

Replies are listed 'Best First'.
Re: mechanize and javascript
by Joost (Canon) on Mar 17, 2007 at 00:27 UTC
Re: mechanize and javascript
by planetscape (Chancellor) on Mar 17, 2007 at 02:17 UTC
Re: mechanize and javascript
by perrin (Chancellor) on Mar 17, 2007 at 03:43 UTC
    Read the JavaScript code, look at what it does, and do the same from Mech. It probably just sets a field or two in the form, which is easy from Mech.
Re: mechanize and javascript
by geekphilosopher (Friar) on Mar 17, 2007 at 06:44 UTC

    You should have a look at WWW::Selenium, an interface to the excellent Selenium Remote Control. Combine it with the automatic Perl code generation of the Selenium IDE Firefox plugin, and writing code that navigates websites is as easy as just clicking through the site. There's even a Test:: module available, if you're wanting to unit test your site.

    (No, I'm not affiliated withe OpenQA, I just use their code a lot at work)

      hey thanks for the help guys, i looked at the Mozilla::Mechanize but when i tried to install it it boiled down to missing Glib and when i tried installing that the following error came up....

      GObject.xs:980: error: `G_TYPE_INITIALLY_UNOWNED' undeclared (first use in this function) GObject.xs:980: error: (Each undeclared identifier is reported only once GObject.xs:980: error: for each function it appears in.) make: *** GObject.o Error 1 /usr/bin/make -- NOT OK

      this happened before when i tried installing a soulseek client for linux. anyway im going to try the WWW::Selenium next
Re: mechanize and javascript (ends)
by tye (Sage) on Mar 17, 2007 at 07:11 UTC

    For this limited of a use of javascript, I think you'd be better off trying HTTP::Recorder.

    - tye