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

This is weird - as the list lives in the main document, it certainly should show up with ->content() after the elements have been added. I'm not aware of any caching going on. You will need to debug this on your own, and make sure that your parsing actually picks up the correct value from ->content (or even use the nodes as returned by ->selector or ->xpath directly.

Replies are listed 'Best First'.
Re^7: WWW::Mechanize::Firefox and dynamic pages
by Special_K (Pilgrim) on Jul 30, 2013 at 05:50 UTC

    Does it matter that the link I'm trying to capture from the page with my script resides inside of an iframe? It looks like this in firebug:

    <iframe id="iframe_canvas" class="smart_sizing_iframe" scrolling="yes" + height="800" frameborder="0" msallowfullscreen="" oallowfullscreen=" +" mozallowfullscreen="" webkitallowfullscreen="" src="javascript:""" +name="iframe_canvas_fb_https" style="height: 472px;"> <html> <head> <body> <div> <a href="link I'm trying to capture"</a> </div> </body> </head> </html> </iframe>

    I already have this in my perl code:

    $mech->allow(plugins => 1, javascript => 1, metaredirects => 1, frames + => 1, subframes => 1, images => 1);

    So it seems like all iframes should be processed correctly, right?

      Yes, it does matter. ->content never looks inside iframe elements.

      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.

        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.