in reply to Re^4: Need help logging into my bank with WWW::Mechanize::Firefox
in thread Need help logging into my bank with WWW::Mechanize::Firefox

That's not a button, it's a plain link styled to appear like a button.

You will have to ->click on that link after filling out the form.

Replies are listed 'Best First'.
Re^6: Need help logging into my bank with WWW::Mechanize::Firefox
by johnblack (Initiate) on Dec 09, 2014 at 20:55 UTC

    Thanks Corion, but I still don't know how to do it. I don't see a link there that I can recognize but I don't know web code. I see a nearby link and tried this after filling out the form:

    $mech->follow_link(url => 'https://mfasa.chase.com/auth/login.html' );

    But that gave an error: No link found matching '//a[(@href = "https://mfasa.chase.com/auth/login.html...

    I see you said use 'click' but my understanding of click is that it is for buttons and so I would need a button name or number but its not a button you say

    And one more question if I may, why was submit_form() not the appropriate call after filling out the form? Thanks.

      ->submit_form would be the proper way if there was a submit element in the form. This is obviously not the case for your project.

      It may be inconvenient, but when automating a website, there is very little to no way around also learning/knowing a bit of HTML and Javascript. The <a class="chase-button ... element is a link, which you have to click after filling out the form. Most likely, that link then triggers some Javascript which collects the values previously filled into that form and sends them to the server.

      If the call to ->follow_link(url => ... fails, then most likely, there is no such link. You will have to inspect the HTML closer. At least from the HTML snippet you posted, the link you want to click has no href attribute. It is contained in a <div> element with the class name loginBtn. I would try first clicking on that div, and if that doesn't work, clicking on the link. The <div> can be found by something like:

      my $target= $mech->selector('.loginBtn', single => 1 );

      The link could be found by something like:

      my $target= $mech->selector('.loginBtn a', single => 1 );