NAME

WWW::Mechanize::Chrome::Node - represent a Chrome HTML node in Perl

SYNOPSIS

    (my $node) = $mech->selector('.download');
    print $node->get_attribute('class'); # "download"

MEMBERS

attributes

The attributes this node has

nodeName

The (tag) name of this node, with a namespace

localName

The local (tag) name of this node

backendNodeId

The id of this node within Chrome

objectId

Another id of this node within Chrome

driver

The Chrome::DevToolsProtocol::Transport instance used to communicate with Chrome

mech

A weak reference to the WWW::Mechanize::Chrome instance used to communicate with Chrome.

METHODS

->nodeId

  print $node->nodeId();

Lazily fetches the node id of this node

->get_attribute

  print $node->get_attribute('outerHTML');

Fetches the attribute of the node from Chrome

->set_attribute

  $node->set_attribute('href' => 'https://example.com');

Sets or creates an attribute of a node. To remove an attribute, pass in the attribute value as undef.

Note that this invalidates the nodeId of every node so you may or may not need to refetch all other nodes or receive stale values.

->get_tag_name

  print $node->get_tag_name();

Fetches the tag name of this node

->get_text

  print $node->get_text();

Returns the text of the node and the contained child nodes.

->set_text

  $node->set_text("Hello World");

Sets the text of the node and the contained child nodes.

REPOSITORY

The public repository of this module is https://github.com/Corion/www-mechanize-chrome.

SUPPORT

The public support forum of this module is https://perlmonks.org/.

TALKS

I've given a German talk at GPW 2017, see http://act.yapc.eu/gpw2017/talk/7027 and https://corion.net/talks for the slides.

At The Perl Conference 2017 in Amsterdam, I also presented a talk, see http://act.perlconference.org/tpc-2017-amsterdam/talk/7022. The slides for the English presentation at TPCiA 2017 are at https://corion.net/talks/WWW-Mechanize-Chrome/www-mechanize-chrome.en.html.

BUG TRACKER

Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=WWW-Mechanize-Chrome or via mail to www-mechanize-Chrome-Bugs@rt.cpan.org.

AUTHOR

Max Maischein corion@cpan.org

COPYRIGHT (c)

Copyright 2010-2019 by Max Maischein corion@cpan.org.

LICENSE

This module is released under the same terms as Perl itself.