[tpm] Yet Another WWW::Mechanize Question (YAWMQ)
Zoffix Znet
zoffix at zoffix.com
Thu Sep 11 16:05:26 PDT 2008
I just did a test script and it works perfectly fine.
Have you trying setting an empty string as a value? Perhaps it's JS that
sets it to a space on your webpage (just a guess)
My page with the form:
#!/usr/bin/env perl
use strict;
use warnings;
use CGI qw/Vars/;
my %q = Vars;
print "Content-type: text/html\n\n",
$q{selrow0} ? "Ticked\n" : "Not ticked\n";
print <<'END';
<form action="" method="GET">
<input type="checkbox" name="selrow0" value=" "
onclick="clicksel(this)">
<input type="submit">
</form>
END
The mech script:
#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new;
$mech->get('http://z/test.pl');
$mech->tick('selrow0', ' ');
$mech->submit;
print $mech->content;
Prints: Ticked
Cheers
On Thu, 2008-09-11 at 18:10 -0400, Madison Kelly wrote:
> Guys, I'm sorry. :P
>
> I've got a stoopid checkbox I need to tick, and for the life of me I
> can't get WWW::Mechanize to 'tick' it. I tick other checkboxes just
> fine, but this one is odd in that the value is a whitespace.
>
> So given this:
>
> <input type="checkbox" name="selrow0" value=" " onclick="clicksel(this)">
>
> What would I need to do to check this? I suspect it's the white space
> tripping me up, but I can't change this form.
>
> This fails, but is "right" so far as the docs seem to say:
>
> $agent->tick("selrow0", " ");
>
> Thanks, as always!
>
> Madi
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
More information about the toronto-pm
mailing list