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

Hello all, I have been stuck on a problem for quite some time. I am trying to post form data to a site that embeds forms within frames.

At the login page of safeway.com, there is a frame with a pzipcode form field that I want to post a zipcode to (in order to browse the online store).

The frame that contains the source I want is located at "https://shop.safeway.com/brands/swy/register/signin.asp?from=/superstore". I am currently trying to use WWW::Mechanize, but it fails to open the frame source.

#! /usr/bin/perl

use LWP 5.64;
use LWP::Simple;
use WWW::Mechanize;

my $browser = new WWW::Mechanize;
$browser->get('https://shop.safeway.com/brands/swy/register/signin.asp?from=/superstore');
$browser->success or die "Can't load frame";

$browser->submit_form(
form_number => 3, fields => {pzipcode=>$zipcode}
);

Does anyone know of a way I can get the frame source and then post a zipcode for the form in the embedded frame? Thanks in advance.
  • Comment on Submit form data embedded in frames using Perl

Replies are listed 'Best First'.
Re: Submit form data embedded in frames using Perl
by daxim (Curate) on Jul 17, 2007 at 10:25 UTC
    I have refactored into the following and it does not fail.
    use WWW::Mechanize qw(); my $browser = WWW::Mechanize->new( autocheck => 1, ); $browser->get('https://shop.safeway.com/brands/swy/register/signin.asp +?from=/superstore'); $browser->submit_form( with_fields => { pzipcode => 90210, }, );