in reply to Accessing unnamed button using WWW::Mechanize

If there is only one button in the form, then you can just specify something like...
$mech->click();
That should do it for you.

Replies are listed 'Best First'.
Re^2: Accessing unnamed button using WWW::Mechanize
by ashish.kvarma (Monk) on Sep 11, 2009 at 09:57 UTC
    onclick of the button calls a javascript function, therefore I don't think just clicking the button through Mechanize will serve the purpose (unless any other module for javascript such as WWW::Mechanize::Plugin::JavaScript is used.)
    If you look at the javascript code
    if (ck==true){ $.post("rpc.f", {credenU: ""+user+"", credenP: ""+pass+"", mns: 1} +, function(data){ if(data.length >0) { $('#serverlisted').html(data); } }); } else{ $.post("rpc.f", {credenU: ""+user+"", credenP: ""+pass+""}, functi +on(data){ if(data.length >0) { $('#serverlisted').html(data); } });
    it seems that JSON data is posted to url "rpc.f" and the data returned is added to #serverlisted (should be an id to div, span or any other tag on page.)
    In my view you need to post the data
    which is either {credenU: ""+user+"", credenP: ""+pass+"", mns: 1} or {credenU: ""+user+"", credenP: ""+pass+""} based on value of mms
    to url "rpc.f" and replace the response recived on tag #serverlisted
    Update: Corrected the typo. thanks marto for pointing it.
    Regards,
    Ashish
Re^2: Accessing unnamed button using WWW::Mechanize
by venkatesan_G02 (Sexton) on Sep 11, 2009 at 13:52 UTC
    There are two buttons in the form