On Dec 13 Andy Lester wrote:
> > In the testing script below I can't seem to set values in a multiple
> > select list with WWW::Mechanize.
>
> Yes, that is a shortcoming of Mech. I'm going to try to fix it this
> weekend.
Thanks for the quick response. In this situation Checkboxes will work
just as well as using select with the multiple attribute.
> I'm glad to see you usin' Mech for testing. My two favorite hats:
> Testing and Mech!
Trying to wear those two hats, I replaced the <SELECT ...
multiple='multiple'> with checkboxes and had problems. So I ran the
tick.t script that comes with WWW::Mechanize which had problems, claiming
there is nor form number 1, but I see one in the tick.html file.
[EMAIL PROTECTED] t]$ perl tick.t
1..6
ok 1 - use WWW::Mechanize;
ok 2 - The object isa WWW::Mechanize
ok 3 - URI shouldn't be an object
not ok 4 - file:/home/jjm/.cpan/build/WWW-Mechanize-0.70/t/t/tick.html
# Failed test (tick.t at line 15)
There is no form numbered 1 at tick.t line 17
Can't call method "find_input" on an undefined value at
/usr/lib/perl5/site_perl/5.6.1/WWW/Mechanize.pm line 597.
# Looks like you planned 6 tests but only ran 4.
# Looks like your test died just after 4.
[EMAIL PROTECTED] t]$ cat tick.t
#!/usr/bin/perl -w
use strict;
use Test::More tests => 6;
use URI::file;
use_ok( 'WWW::Mechanize' );
my $mech = WWW::Mechanize->new( cookie_jar => undef );
isa_ok( $mech, "WWW::Mechanize" );
my $uri = URI::file->new_abs( "t/tick.html" )->as_string;
$mech->get( $uri );
is( ref $mech->uri, "", "URI shouldn't be an object" );
ok( $mech->success, $uri );
$mech->form_number( 1 );# This is line 17
$mech->tick("foo","hello");
$mech->tick("foo","bye");
$mech->untick("foo","hello");
my $form = $mech->form_number(1);
isa_ok( $form, 'HTML::Form' );
my $reqstring = $form->click->as_string;
my $wanted = <<'EOT';
POST http://localhost/
Content-Length: 21
Content-Type: application/x-www-form-urlencoded
foo=bye&submit=Submit
EOT
is( $reqstring, $wanted, "Proper posting" );
[EMAIL PROTECTED] t]$ cat tick.html
<html>
<body>
<form action="http://localhost/" method="POST">
<input type="checkbox" name="foo" value="hello" /> Hello<br />
<input type="checkbox" name="foo" value="bye" /> Bye<br />
<input type="checkbox" name="foo" value="arse" /> Arse<br />
<input type="checkbox" name="foo" value="wibble" /> Wibble<br />
<input type="checkbox" name="foo" value="foo" /> Foo<br />
<input type="Submit" name="submit" value="Submit" label="Sumbit" />
</form>
</body>
[EMAIL PROTECTED] t]$ perl -MWWW::Mechanize -e 'print
$WWW::Mechanize::VERSION,"\n"'
0.70
Any ideas?
Thanks in advance,
Jim