there seems to be an issue with this...
when i "grab" the frame i'm interested in, and i submit the form, how do i
go about getting the updated content/html from the parent frame??
here's a section of code that i'm using...
---------------------------------------------------
use HTML::TreeBuilder;
use LWP::UserAgent;
use WWW::Mechanize;
my $b = WWW::Mechanize->new();
$ua = new LWP::UserAgent;
$ua->timeout(30);
$ua->agent("Mozilla/4.0 (compatible; MSIE 4.01; Windows95)" .
$ua->agent);
my $cstr;
#
# get the top level university class site
#
my $base_url = "http://ntweb8.ais.msu.edu/ScheduleBook/Schedule.asp";
my $req = new HTTP::Request GET => $base_url;
$req->content_type('application/x-www-form-urlencoded');
my $res = $ua->request($req);
my $q1c = $res->content;
print $q1c;
# go ahead and get the dept page..
# use www::machanize
my $agent = WWW::Mechanize->new();
$agent->get($base_url);
$agent->follow_link(text=>'selection.asp');
my $_form = $agent->form_name('thisform');
if (!$_form) {
warn "Nothing came back";
exit;
}
$agent->field('Semester' => "US041042summer sem 2004");
$agent->field('Subject' => "EGR");
$agent->field('Instructor' => "ANY");
$agent->field('StartTime' => "0600");
$agent->field('EndTime' => "2350");
$agent->tick('Monday');
$agent->tick('Tuesday');
$agent->tick('Wednsday');
$agent->tick('Thursday');
$agent->tick('Friday');
$agent->tick('OpenCourses', "A");
$agent->field('On Campus');
$agent->field('Off Campus');
$agent->field('Online Courses');
$agent->field('Study Abroad');
$agent->submit();
print "-- ".$agent->content(). "\n";
die
---------------------------------------------------
i've tried a variety of possible approaches to the follow_form()... with no
success..
so i'm inclined to believe there's something i'm missing...
thanks
-bruce
-----Original Message-----
From: Gedanken [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 6:34 AM
To: bruce
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: frame question- lwp/mechanize
On Thu, 10 Jun 2004, bruce wrote:
there may be a smarter way to do it, but 'regular' mech works just fine
with frames. after you do a 'get' to grab the frameset, you can just do
'get's to grab the frame you want.
like
$agent->get("someframeset.html");
$agent->get("leftNav.html")
theres no need to even think of them as frames.
hey...
can www::mechanize be used to deal with frame sites.. or does one have to
use lwp::useragent::framesready...??
is there a sample of code that someone could point me to... didn't really
find anything on google that answered this....
basically, i want to get a given frame (foo), submit a form on the frame
(foo), and read the results that are displayed in another frame (dog).
thanks...
-bruce
--
gedanken