in reply to Re^7: WWW::Mechanize::Firefox and dynamic pages
in thread WWW::Mechanize::Firefox and dynamic pages

Is there a way to make

content()

look into frames? I added this to my code:

my @frames = $mech->expand_frames(); my $frame_ctr = 0; for ($frame_ctr = 0; $frame_ctr < @frames; $frame_ctr++) { printf("frames[%s] = %s\n", $frame_ctr, $frames[$frame_ctr]); }

But I'm not really sure what to do with the frames that were returned.

Replies are listed 'Best First'.
Re^9: WWW::Mechanize::Firefox and dynamic pages
by Corion (Patriarch) on Aug 01, 2013 at 06:52 UTC

    What you get back are DOM nodes. You can access their attributes. For example, the innerHTML attribute:

    print $frame->{innerHTML}

    By doing that, you've mostly left the area that WWW::Mechanize::Firefox supports and you will have to consult the Firefox documentation for what attributes and methods are supported.

      Just because I hate finding questions online with no resolution, I'm coming back with the answer. Here is how I was able to find the link I was looking for within the page's HTML:

      my @test_frames = $mech->xpath('/html/body/div/p/a', one => 1, frames +=> 1); printf(TEST_FH "result is %s\n", $test_frames[0]->{outerHTML});

      I obtained the xpath using Firebug (highlight the link on the webpage, right click, select "copy Xpath") then used the outerHTML (as opposed to innerHTML) to get the URL.