morgon has asked for the wisdom of the Perl Monks concerning the following question:
, I am playing around with WWW::Mechanize::Chrome and would like to understand the following:
When (as an example) I do this:
I get several html-documents as $mech->selector("html") does not only return one element (as I had expected) but a whole array (and I have no clue what these are, maybe iframes I don't know).use strict; use WWW::Mechanize::Chrome; my $url = "https://www.economist.com/china/2018/11/03/think-of-china-a +s-a-giant-sub-prime-lender-in-latin-america"; my $mech = WWW::Mechanize::Chrome->new(); $mech->get($url); print $_->nodeName, "\n\n", $_->get_attribute('innerHTML'), "\n\n" for + $mech->selector("html");
What is the proper way to only retrieve the html of the main page?
I hope my question is understandable...
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: get html via WWW::Mechanize::Chrome
by Corion (Patriarch) on Nov 04, 2018 at 15:54 UTC | |
by morgon (Priest) on Nov 04, 2018 at 16:05 UTC | |
by Corion (Patriarch) on Nov 04, 2018 at 16:13 UTC | |
by morgon (Priest) on Nov 04, 2018 at 16:19 UTC |