ghenry has asked for the wisdom of the Perl Monks concerning the following question:

Dear Master Monks,

I have a form that has this on it:

<input type=image src="/images/buttons/login.gif" alt="Login">
which is the only thing to click. How can I get Mech to submit the form?

mech-dump gives:

login= (text) pass= (password) secure_login=0 (radio) [1/SSL |*0/Non-SSL] <NONAME>=<UNDEF> (image)

So far I have:

# Fields to fill out, since there is only one button, # try to let Mech find it $mech->submit_form( form_name => 'loginForm', fields => { login => $user, pass => $passwd, secure_login => '0', }, )->is_success() || die "Unable to login to $login_page, stopped"; # Ensure we've logged in successfully my $logout = $mech->find_link( text => "Logout" ); die "Did not log in, stopped" unless $logout;

Now I get the message about "Did not log in", so maybe my find_link() is incorrect?

In the click(), it says:

If there is only one button on the form, $mech->click() with no argume +nts simply clicks that one button.
So that's what I have done. Is that right?

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

Replies are listed 'Best First'.
Re: WWW::Mechanize - Image used as button with no name?
by Roy Johnson (Monsignor) on Dec 06, 2005 at 18:08 UTC
    Does it work? If so, it's right. If not, it's wrong. :-)

    Since it's not really a button, I would say use submit() instead of click().


    Caution: Contents may have been coded under pressure.
Re: WWW::Mechanize - Image used as button with no name?
by planetscape (Chancellor) on Dec 07, 2005 at 02:01 UTC