in reply to WWW::Mechanize::Chrome: Click on button not part of a form

You need the form tag. As far as i remember. You may also wish to validate your HTML to avoid pain in the ass. Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^2: WWW::Mechanize::Chrome: Click on button not part of a form
by stevieb (Canon) on Dec 01, 2019 at 16:10 UTC

    As per Corion's reply, you can use $mech->click({ selector => '#element-id' }); and that works great.

    Since I'm using pure JS/jQuery functions, I don't need or want a form in this case, as there's nothing to submit it to. I do all the logic in client-side code, then dump it off to a route on the server without ever leaving the page.

    Thanks for the validator link though, that's quite handy.

      He! May be it works. HTML is always good for a surprise. But the markup you supplied is not valid. You may try it yourself ibidem. I hope I don’t miss the point. Good luck and have some fun 😎

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help