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

i create a perl file to automate fill and reset form. but i'm stucked with a form that must tick a checkbox to proceed. i can take the checkbox name, type and value:

my $inName= $m->xpath('/html/body/div/div/div/form/table[2]/tbody/tr[2 +]/td[2]/label/input', single =>1)->{name}; my $inType= $m->xpath('/html/body/div/div/div/form/table[2]/tbody/ +tr[2]/td[2]/label/input', single =>1)->{type}; my $inValue= $m->xpath('/html/body/div/div/div/form/table[2]/tbody +/tr[2]/td[2]/label/input', single =>1)->{value}; print $inName." ".$inType." ".$inValue;

which result is: stuinfo checkbox value1

below is the line i have tried and it's appropriate respond:

$m->tick($inName,$inValue); <<<<nothing happened for this one

$m->field( $inName => $inValue ); <<<<nothing happened for this one

$m->field( $inName => $inValue , 'on');<<<<nothing happened for this one

$m->tick($inName => $inValue ); <<<<No elements found for Checkbox with name 'stuinfo' and value 'value1' at auto.plx line 77

any help very appreciated, thank you

Replies are listed 'Best First'.
Re: www-mechanize-firefox checkbox problem
by Anonymous Monk on Apr 01, 2011 at 09:50 UTC
Re: www-mechanize-firefox checkbox problem
by moritz (Cardinal) on Apr 01, 2011 at 09:56 UTC

    You show us some objects and method calls, yet you don't even tell us of which class they are, and which modules you use. Are we supposed to know the method names of all >20k modules on CPAN by heart, as well as those of proprietary modules that we can't even know about?

    See also: How (Not) To Ask A Question.

    Update: ooops, I ignored the title. Still the post doesn't contain any code that we could execute to reproduce the problem, so the advice still stands.

      Hihi, the title hints at the module, but I agree :)
        sorry about that, is it this?
        #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize::Firefox; my $m = WWW::Mechanize::Firefox->new(repl=>"localhost:4243",activate=> +1);

        so, i just want to check the checkbox located in /html/body/div/div/div/form/table2/tbody/tr2/td2/label/input before i click submit

        but it seemed that i didnt use the $m->tick() or $m->field() correctly. for starters, what must i throw to the code for tick or field ?

        i think i have to use tick or field to check a checkbox, or is there any other way?