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
nodeId
The nodeId of this node
localName
The local (tag) name of this node
backendNodeId
The id of this node within Chrome
cachedNodeId
The cached id of this node for this session
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.
CONSTRUCTORS
fetchNode
WWW::Mechanize::Chrome->fetchNode(
nodeId => $nodeId,
driver => $mech->driver,
)->get()
Returns a Future that returns a populated node.
METHODS
->get_attribute
print $node->get_attribute('outerHTML');
Fetches the attribute of the node from Chrome
print $node->get_attribute('href', live => 1);
Force a live query of the attribute to Chrome. If the attribute was declared on the node, this overrides the stored value and queries Chrome again for the current value of the attribute.
->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 Github bug queue at https://github.com/Corion/WWW-Mechanize-Chrome/issues
AUTHOR
Max Maischein corion@cpan.org
COPYRIGHT (c)
Copyright 2010-2024 by Max Maischein corion@cpan.org
.
LICENSE
This module is released under the same terms as Perl itself.