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

Hello, everyone! I'm having trouble getting WWW::Mechanize::Firefox to scroll down lines or pages in my current window.

What I'm trying to do is navigate through some dialogues that generate a PDF in the window. Then I use xpath to pull the text from a few specific divs. The problem I'm running into is that it only seems to pre-load the first 2 pages of the PDF document and I need to scroll down to load the rest before xpath will snag all of the text I need.

Here is my code:

my $mech = WWW::Mechanize::Firefox->new( activate => 1, ); $mech->get('https://managemymarket.com/managers/acReporting/SalesForMa +rket.aspx?id=2'); $mech->select("#marketID", '1740'); $mech->field("#startDate", '4/1/2015'); $mech->field("#endDate", $date); $mech->click({ selector => '#btnRun' }); my ($window,$type) = $mech->eval('window'); $window->scrollByLines(188);
No scrolling occurs however. Any help would be greatly appreciated!

Cheers,

Nony

UPDATE: Looks like scrollByLines does not work in the built in PDF viewer. However, I was able to iterate through the pages numbers using $mech->field("#pageNumber", $i) to produce the effect that I needed.

Replies are listed 'Best First'.
Re: Mechanize::Firefox can't get it to scroll
by GotToBTru (Prior) on May 04, 2015 at 18:40 UTC

    Try the forward method instead of eval?

    Dum Spiro Spero
      Hmm, that didn't work for me.