Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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:

test.html

<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="test.js" type="text/javascript"></script> </head> <body> <p>Not loaded yet.</p> </body> </html>

test.js

$(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."

greg

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://991545]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2015-07-30 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls