Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: get html via WWW::Mechanize::Chrome

by morgon (Priest)
on Nov 04, 2018 at 16:05 UTC ( [id://1225205]=note: print w/replies, xml ) Need Help??


in reply to Re: get html via WWW::Mechanize::Chrome
in thread get html via WWW::Mechanize::Chrome

Not knowing how to do it is what kept me.

If I have this array returned from $mech->selector("html") - how do I filter out the iframes?

Many thanks!

  • Comment on Re^2: get html via WWW::Mechanize::Chrome

Replies are listed 'Best First'.
Re^3: get html via WWW::Mechanize::Chrome
by Corion (Patriarch) on Nov 04, 2018 at 16:13 UTC

    Maybe now is a good time to learn about the "view-source" protocol (hotkey ctrl+u), which makes almost all browsers show you the HTML source of the current page. Also consider the Chrome Developer Tools which can be reached using ctrl+shift+i in Google Chrome.

    What is wrong with using ->content?

    If you have a bunch of html elements, maybe you can check ->get_attribute('ownerDocument'), but that's just a wild guess on my part.

      I can't try at the moment, but while you're here I may just as well ask you...

      My understanding was (and that may very well be wrong) that ->content would give you the html-source as it is sent by the server.

      But what I am interested in is the html that results once some js-scripts have modified the dom.

      I thought that I would be able to retrieve that via innerHTML.

      I will try later, but maybe you could enlighten me if my whole understanding is way off...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found