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

The XPath returned from the code is:

/html/body/div/p/a

Replies are listed 'Best First'.
Re^6: WWW::Mechanize::Firefox and dynamic pages
by Corion (Patriarch) on Jul 29, 2013 at 06:58 UTC

    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.

      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.