in reply to Re^3: No Clickable button with name.... in WWW::Scripter
in thread No Clickable button with name.... in WWW::Scripter

Hi

I have tried this code but still it is not working, it giving me previous page content.

sub click { my $input; my $button="successOK"; my $form = $w->current_form; for ($form->inputs) { next unless $_->type =~ /^(?:submit|image|button)\z/; next if $button && $_->name ne $button; next if $_->disabled; $input = $_; last; } Carp::croak("No clickable input with name $button"); if ($button && !$input) { print "##############OK####################i"; print $w->content(); } else { print "######### NOT OK ###############"; } } click();

It is giving me  No clickable input with name successOK

Can you please point out what wrong I've done here?

Replies are listed 'Best First'.
Re^5: No Clickable button with name.... in WWW::Scripter
by Corion (Patriarch) on Jun 30, 2017 at 10:51 UTC

    You always call Carp::croak, no matter what.

    Maybe you need:

    if( ! $input) { Carp::croak("No clickable input with name $button") };
Re^5: No Clickable button with name.... in WWW::Scripter
by marto (Cardinal) on Jun 30, 2017 at 11:00 UTC