I want to extract the text only for heading Node Object Methods from a webpage. The specific HMTL part is as follows:
Node Object Properties
You can use XPath to extract data from the very next table after the heading Node Object Methods
, like so
use Web::Scraper;
my $html = do { local $/; };
my $methods = scraper {
process '//h2[.="Node Object Methods"]/following-sibling::table[1]//tr/td[1]',
'renners[]' => 'TEXT';
};
my $res = $methods->scrape( $html );
say join "\n", @{ $res->{renners} };
The output will be
appendChild()
cloneNode()
compareDocumentPosition()
getFeature(feature,version)
getUserData(key)
hasAttributes()
hasChildNodes()
insertBefore()