Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: WWW::Mechanize::Firefox and dynamic pages

by Loops (Curate)
on Jul 28, 2013 at 00:28 UTC ( [id://1046695]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize::Firefox and dynamic pages

Don't know if it will trigger the necessary loading you're looking for, but the code below will load a page and scroll down 188 lines. Once you have the window object you can use any method listed here. There are a handful of methods that allow you to scroll based on different parameters.

My guess that if this is going to work as you hope, you'll have to scroll incrementally and not just pop to the bottom of the document.

use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(tab => 'current'); $mech->get('http://search.cpan.org/~corion/WWW-Mechanize-Firefox/lib/W +WW/Mechanize/Firefox.pm'); my ($window,$type) = $mech->eval('window'); $window->scrollByLines(188);

Replies are listed 'Best First'.
Re^2: WWW::Mechanize::Firefox and dynamic pages
by Special_K (Monk) on Jul 28, 2013 at 06:25 UTC

    Wow, I had no idea I could access all those functions. That's actually very helpful in general for some other things I was working on. I'll have to try those scroll functions out.

      UPDATE: Using the scroll function makes the bar scroll, but then when I call:

      $mech->content()

      The friends' names aren't there, even though they are there on the page and I can find them using Firebug. How do I get all the data to load when I call mech->content()?

        Maybe the additional elements live in another iframe? What is the XPath expression you get from Firebug for the new elements?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found