1nelly1 has asked for the wisdom of the Perl Monks concerning the following question:

I have problems to navigate in the DOM tree. Starting from a node $node (WWW::Mechanize::Chrome::Node) in WWW::Mechanize::Chrome I would like to access the parent node. In WWW::Mechanize::Firefox I did this by using for example an XPath like
@parent_node = $mech->xpath('./parent::*', node => $node )
However it was also possible to directly access nodes like for instance with
$node->{parentElement}
I do not know how to realize this in WWW::Mechanize::Chrome. The author of that module writes in the documentation regarding my first approach: "Querying relative to a node only works for restricting to children of the node, not for anything else. This is because we need to do the ancestor filtering ourselves instead of having a Chrome API for it." Regarding my second approach I noticed that the WWW::Mechanize::Chrome::Node-Object is providing a parentID but I could not figure out how this will help. How can I access a node-object by using this ID?

I would like to know how to access a parent node in order to generate an xpath from a node as I did within WWW::Mechanize::Firefox. Another solution could be the use of the callFunctionOn-function provided by WWW::Mechanize::Chrome and to realize that with JavaScript. However I did not check this out so far.

If the problem with the parent node is solvable then the next problem will be that I will need something like
@preceding_sibling = $mech->xpath("count(preceding-sibling::$node_name)", node => $node )
I did not check if this will work in WWW::Mechanize::Chrome.