The form is not great, because it really contains three fields with the same name date, so you will have to fetch the individual fields and explicitly set them:
Thanks, Corion, I think we're almost there. I've got this pared down as far as I can to make an SSCCE. I can't get perl to think I have a valid selector:
say (...) interpreted as function at ./6.1.pluto.pl line 47.
2020/04/20 20:10:39 Connected to ws://127.0.0.1:40757/devtools/browser
found the one and only form
Invalid rule, couldn't parse '//*[@name="date", node => $mech->current
+_form ]' at /usr/local/share/perl/5.26.1/HTML/Selector/XPath.pm line
Source, with the critical line tried several different ways:
use Log::Log4perl qw(:easy);
my $site =
my $mech = WWW::Mechanize::Chrome->new( headless => 1, );
my $guess = 2458960; #Earth day 2020 in julian days
say "found the one and only form"
# my best guess...aka...trial 1
# $mech->field( date => '2', jd => $guess );
# stderr: 3 elements found for input with name 'date' at ./6.1.pluto.p
+l line 21.
# your first guess...aka trial 2
# my @date_fields =$mech->selector( './/*[@name="date"]', node => $sel
# stderr: Global symbol "$self" requires explicit package name
# 3rd guess
#my @date_fields =$mech->selector( './/*[@name="date"]', node => $mech
# stderr: Invalid rule, couldn't parse '//*[@name="date"]' at /usr/loc
+al/share/perl/5.26.1/HTML/Selector/XPath.pm line 283.
# 4th guess
# my @date_fields =$mech->selector( './/*[@name="date", node => $self-
# stderr: Invalid rule, couldn't parse '//*[@name="date", node => $sel
# 5th guess
my @date_fields =$mech->selector( './/*[@name="date", node => $mech->c
# Invalid rule, couldn't parse '//*[@name="date", node => $mech->curre
$mech->set_field( $date_fields => $guess );
$mech->click_button( value => "Update" ); # this seems similar to W
say "clickbutton succeeded"
my $string = $mech->uri;
say ("We are at $string")
That lays it out there as starkly as I can. VielenDank und Gruss aus Amiland.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.