Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Accessing frames with WWW::Mechanize

by ermai (Initiate)
on Feb 12, 2018 at 13:16 UTC ( [id://1208992]=perlquestion: print w/replies, xml ) Need Help??

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

I use the WWW::Mechanize module to access a URL with two frames. I enter a word into the first frame and submit it, and then download the data that is returned in the second frame. But somehow it hangs on accessing the second frame, how to link frames in url and manipulate them ? The URL https://imgur.com/a/eBmBG
<html> ....... <frameset rows="40%,*"> <frame name="rtop" src="123.asp" target="rbottom"> <frame name="rbottom" src="444.html" scrolling="auto"> ....... </noframes> </frameset> </html>
submit tag in HTML of the end of the first frame when linking it
<td width=28% align=center> <input type="submit" name="act" value="xxx" class="cbutton">
My Perl code
#!c:\\perl\\bin use strict; use WWW::Mechanize; my $url = "myurl"; my $Part = 'mykey'; my $outfile1 = "out1.html"; my $mech = WWW::Mechanize->new(); $mech->get($url); $mech->follow_link(tag => "frame"); # open first frame in document $mech->field ('' => $Part); $mech->submit(); $mech->follow_link(tag => "frame"); # open 2nd frame in document, whe +re it hangs my $output_page = $mech->content(); open(OUTFILE, ">$outfile1"); print OUTFILE "$output_page"; close(OUTFILE);

Replies are listed 'Best First'.
Re: Accessing frames with WWW::Mechanize
by haukex (Archbishop) on Feb 12, 2018 at 16:40 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1208992]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-16 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found