in reply to No Clickable button with name.... in WWW::Scripter

Have you made certain that the button successOK is within a <form> element?

Replies are listed 'Best First'.
Re^2: No Clickable button with name.... in WWW::Scripter
by trahulprajapati (Novice) on Jun 29, 2017 at 10:05 UTC

    Yes, successOK is in <form> element

    .

      Ah, now I see.

      After a quick source dive, WWW::Scripter does not support <input type="button" for ->click:

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

      You might want to report this as a bug via the bug tracker, but as a workaround, consider changing the code, so that it also can click on a button:

      next unless $_->type =~ /^(?:submit|image|button)\z/;

        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?