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

Maybe just use

$mech->content

Also, when diagnosing problems, and suspecting iframe elements, what kept you from verifying your suspicoin?

Replies are listed 'Best First'.
Re^2: get html via WWW::Mechanize::Chrome
by morgon (Priest) on Nov 04, 2018 at 16:05 UTC
    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!

      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...