I have found that sometimes using $mech->click() works in situations where $mech->submit() does not.

For example:

If I have a page that redirects to another page, based on a click input rather than a submit to the same URL.

This becomes especially true in the world of dotNet where many submit buttons fire a JavaScript event to verify the form before allowing the page to be submitted.

Usually, however, these same buttons have names and IDs, because that would be good website design. (Example: $mech->click('btnSubmit');) Though sometimes, just occasionally, buttons have neither a name nor and ID. This is where $mech->click() comes in handy.

From the Documentation:

If there is only one button on the form, $mech->click() with no arguments simply clicks that one button.

In reply to Re^2: WWW::Mechanize HTTPS by BigRare
in thread WWW::Mechanize HTTPS by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.