After further testing I verified the following:
1. I am using WWW-Mechanize-Chrome-0.65
2. I am using Chrome 87.0.4280.141 (Official Build) (64-bit)
3. Adding the $mech->sleep(5); after the $post_response->is_success || die $post_response->status_line; as you have done above fixed my problem. Is this sleep() call always necessary after a get() due to the following (taken from the documentation):
Note that the returned HTTP::Response object gets the response body filled in lazily, so you might have to wait a moment to get the response body from the result. This is a premature optimization and later releases of WWW::Mechanize::Chrome are planned to fetch the response body immediately when accessing the response body.
Finally, I noticed that if I change this line:
$mech->click({id => 'ProductSelect-option-color-solar-8568844557'});
to the following:
my $response = $mech->click({id => 'ProductSelect-option-color-solar-8
+568844557'});
$mech->sleep(5);
print Dumper($response);
if ($response->is_success)
{
printf("click succeeded\n");
}
the output is:
> ./www_mechanize_chrome_testcase.pl
$VAR1 = [];
Can't call method "is_success" on unblessed reference at ./www_mechani
+ze_chrome_testcase.pl line 27.
Is that expected? If $mech->click() returns an HTTP::Response object, shouldn't I be able to call the is_success method?