Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: (almost) preserving a web page

by Corion (Pope)
on Jun 18, 2011 at 06:51 UTC ( #910305=note: print w/ replies, xml ) Need Help??


in reply to Re: (almost) preserving a web page
in thread (almost) preserving a web page

I wouldn't use Javascript for getting at the text:

print $mech->text

Alternatively, if you're really interested in the textContent of a specific element, use

print $element->{textContent}

Thanks to MozRepl::RemoteObject, almost all stuff you can get at by Javascript, you can get at by using Perl.

#!perl -w use strict; use WWW::Mechanize::Firefox::DSL; get 'http://perlmonks.org'; print text


Comment on Re^2: (almost) preserving a web page
Select or Download Code
Replies are listed 'Best First'.
Re^3: (almost) preserving a web page
by Anonymous Monk on Jun 18, 2011 at 07:02 UTC
    Thanks :) The javascript was just proof of concept for the correct DOM incantation ... I have never actually used WWW::Mechanize::Firefox :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-08-03 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (19 votes), past polls