in reply to Re^3: help clicking radio buttons using WWW::Mechanize::Chrome
in thread help clicking radio buttons using WWW::Mechanize::Chrome

I noticed that adding the following line from your example fixed my code:

$mech->sleep(5);

Generally speaking, should one always call $mech->sleep(); after a call to $mech->get() (and possibly other methods)? I didn't see this explicitly mentioned in the documentation for the get() method but I'm not a web developer so maybe it's just common knowledge that something like that is required?

Replies are listed 'Best First'.
Re^5: help clicking radio buttons using WWW::Mechanize::Chrome
by Corion (Patriarch) on Jan 15, 2021 at 22:32 UTC

    This depends on the page. In theory it should not be necessary, but if the page loads other Javascript scripts and more content before it "really" displays the content, this cannot be detected by WWW::Mechanize::Chrome. In such cases, you need to blindly call ->sleep() and hope that the content arrives in time.