in reply to Re: Redirecting Forms with WWW::Mechanize
in thread Redirecting Forms with WWW::Mechanize

To make a long story very short, it turns out that there was more than one button on the form. I didn't realize this. The redirect works perfectly. I merely had to select the correct button.

$webtest->submit_form( form_name => 'lookup', button => 'do_search', fields => { title_name => 'Suspects', });

Everyone be sure to /msg Ovid RTFM :)

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Re: Re: Redirecting Forms with WWW::Mechanize
by petdance (Parson) on Oct 01, 2003 at 03:24 UTC
    That's why I have the mech-dump program included with Mech. Run it against the page you're interested in and you'll have a handy summary of what's going on in the page.

    xoxo,
    Andy

      Andy, Can you tell me how mech-dump works? I'm trying to post a reply to a friends forum. I get the page like this
      get("http://user:passwd\@www.somesite.com/subdir/_vti_bin/shtml.exe/po +st.htm?474")
      I checked response() and this works fine. I get the form and fill in the field like this.
      $w->form_number(1); $w->field('Comments', 'woo-hoo');
      Again, this works fine. The button to post the reply isn't named so I do this.
      $w->submit_form();
      Then I check the response
      my $r = $w->response(); print 'error_as_HTML: '.$r->error_as_HTML."\n";
      and get a "401 Authorization Required" error.

      I think the problem is that the ?474 in the url is a dynamic number assigned by the shtml code. That's one thing I have NO idea how to automate. I don't know the logic on how Microsoft generates that number or on how I can make the post.

      Do you have any idea? Or can you point me in the right direction? I've given up.

      Thanks,
      monktim

        If that 474 is handed to you from MS, then you need to back up a level to the part of the transaction where you DO get that URL.

        As to how mech-dump works, just call "mech-dump --forms URL"

        xoxo,
        Andy