in reply to Mechanize Problems

My boilerplate advice is this:

I would try using a module such as HTTP::Recorder or WWW::Mechanize::Shell to record a successful manual form submission. The output of HTTP::Recorder, for instance, can be "dropped" right into your WWW::Mechanize scripts.

Another important tool for finding out what is really happening behind the scenes between server and browser is a protocol analyzer such as Ethereal.

Don't forget that Super Search is your friend here on PM. Many questions such as yours have been asked recently...

Good luck,

planetscape

Replies are listed 'Best First'.
Re^2: Mechanize Problems
by Anonymous Monk on Dec 14, 2005 at 17:58 UTC
    Thank you. I tried Mech::Shell. A very nice tool. But unfortunately it generates the code I wrote (a bit different of course) with the same problem. Well never ind I have to accept that the site I want to reach must have a subtil bug.

      Some experimentation with HTTP::Recorder suggests that what you want in place of $mech->click_button(value => "Fold it"); is instead: $mech->click('Action'); :

      $agent->get('http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi'); $agent->form_number(1); $agent->tick('toggles', '-noLP'); $agent->field('name', 'fakename'); $agent->tick('SVG', 'on'); $agent->field('email', name@domain.com'); $agent->field('Temp', '37'); $agent->tick('plot', 'on'); $agent->field('Params', 'RNA'); $agent->field('Sequence', 'GATTACAGATTACAGATTACA'); $agent->field('pffold', 'pf'); $agent->click('Action');

      (HTTP::Recorder records scripts using "$agent" instead of "$mech".)

      Viewing the HTML source of the page in question would have revealed your error:

      <input type="hidden" name="rec-form1-submit-Action" value=1> <input type="submit" name="Action" value="Fold it"> ^^^^^^

      HTH,

      planetscape