http://qs321.pair.com?node_id=11115857


in reply to Re^4: running an example script with WWW::Mechanize* module
in thread running an example script with WWW::Mechanize* module

Invalid rule, couldn't parse '//*[@name="date", node => $mech->current +_form ]'

This looks as if you're mixing Perl code and an XPath expression in the same string.

my @date_fields =$mech->selector( './/*[@name="date"]', node => $mech +->current_form ); # stderr: Invalid rule, couldn't parse '//*[@name="date"]' at /usr/loc +al/share/perl/5.26.1/HTML/Selector/XPath.pm line 283.

This is weird - I think this should still parse as an XPath expression. Does the following work and give the expected result?

my @date_fields =$mech->xpath( './/*[@name="date"]', node => $mech->c +urrent_form );

With version 0.48 of WWW::Mechanize::Chrome, ->set_fields now also supports selecing input elements by their name and index:

$mech->set_fields( date => [3, $date_value], );