6 use Test::More tests => 11;
10 delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
11 use_ok( 'WWW::Mechanize' );
14 my $mech = WWW::Mechanize->new( cookie_jar => undef );
15 isa_ok( $mech, 'WWW::Mechanize' );
17 my $uri = URI::file->new_abs( 't/find_inputs.html' )->as_string;
20 ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
23 my @inputs = $mech->find_all_inputs();
24 is( scalar @inputs, 3, 'Exactly three inputs' );
26 my @submits = $mech->find_all_submits();
27 is( scalar @submits, 2, 'Exactly two submits' );
31 $mech->form_number(2);
32 my @inputs = $mech->find_all_inputs();
33 is( scalar @inputs, 4, 'Exactly four inputs' );
35 my @submits = $mech->find_all_submits();
36 is( scalar @submits, 1, 'Exactly one submit' );
40 $mech->form_number(3);
41 my @inputs = $mech->find_all_inputs();
42 is( scalar @inputs, 5, 'Exactly five inputs' );
44 my @relatives = $mech->find_all_inputs( name_regex => qr/^Your/ );
45 is( scalar @relatives, 4, 'Found four relatives' );
47 my @sisters = $mech->find_all_inputs( name => 'YourSister' );
48 is( scalar @sisters, 2, 'Found two sisters' );
50 my @submit_sisters = $mech->find_all_inputs( name => 'YourSister' );
51 is( scalar @submit_sisters, 2, 'But no sisters are submits' );