Ovid has asked for the wisdom of the Perl Monks concerning the following question:
I am writing some Web tests and am using WWW::Mechanize to emulate a browser. All went well until I encountered a rather bizarre form.
$webtest->submit_form( form_name => 'lookup', fields => { title => $some_title, }); is($webtest->title, 'Film Lookup Results', 'The Film Lookup title +should be correct'); like($webtest->content, qr/Usual Suspects, The/, '... and have som +e valid content');
As it turns out, the search works by redirecting the user to the results page, rather than simply returning the results. Thus, my title and content tests fail as the webtest is not automatically following the redirect. I tried using the WWW::Mechanize::redirect_ok() method, but I can't figure it out from the docs. They don't make it clear that a request object is a necessary argument. I also was wondering if I need to just grab the URI from the headers and just go there directly, but I've not tried that yet. Any suggestions?
Cheers,
Ovid
New address of my CGI Course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Redirecting Forms with WWW::Mechanize
by petdance (Parson) on Sep 30, 2003 at 20:17 UTC | |
by Ovid (Cardinal) on Sep 30, 2003 at 22:23 UTC | |
by petdance (Parson) on Oct 01, 2003 at 03:24 UTC | |
by Anonymous Monk on Oct 08, 2003 at 20:33 UTC | |
by petdance (Parson) on Oct 09, 2003 at 02:48 UTC | |
| |
by Ovid (Cardinal) on Sep 30, 2003 at 21:04 UTC |