Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

WWW::Mechanize for page source

by Anonymous Monk
on Sep 04, 2012 at 05:43 UTC ( #991545=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use WWW::Mechanize to capture the source of the page after all javaScript have executed. content() captures only the code on the page load - before the javaScript executes.
How do I accomplish that?

My code:


<!DOCTYPE html> <html> <head> <script src=""></script> <script src="test.js" type="text/javascript"></script> </head> <body> <p>Not loaded yet.</p> </body> </html>


$(document).ready(function () { $("p").text("The DOM is now loaded and can be manipulated."); });

What method can I use so my captured source has "The DOM is now loaded and can be manipulated." instead of "Not loaded yet."


Replies are listed 'Best First'.
Re: WWW::Mechanize for page source
by Corion (Pope) on Sep 04, 2012 at 07:17 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://991545]
Approved by kcott
[Discipulus]: dont be so sure choroba.. 11 years is not too long for an Eatalian judgement
[choroba]: I've moved to Prague in the meantime, they can't reach me anymore :-)
[Discipulus]: Eataly: average 8years and 7months for all 3 degrees of judgement..

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-11-20 09:42 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (286 votes). Check out past polls.