5 use Test::More no_plan => 1;
9 delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Placates taint-unsafe Cwd.pm in 5.6.1
10 use_ok( 'WWW::Mechanize' );
13 my $mech = WWW::Mechanize->new( cookie_jar => undef );
14 isa_ok( $mech, 'WWW::Mechanize' );
16 my $uri = URI::file->new_abs( 't/find_link_id.html' )->as_string;
19 ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
22 my $x = $mech->find_link( id => 'signature' );
23 isa_ok( $x, 'WWW::Mechanize::Link' );
24 is( $x->url, 'signature.html', 'found link with given ID' );
28 my $x = $mech->find_link( tag => 'iframe', class => 'smart_iframe' );
29 isa_ok( $x, 'WWW::Mechanize::Link' );
30 is( $x->url, 'http://boo.xyz.com/boo_app', 'found link within "iframe" with given class' );
34 my $x = $mech->find_link( id_regex => qr/^sig/ );
35 isa_ok( $x, 'WWW::Mechanize::Link' );
36 is( $x->url, 'signature.html', 'found link with ID matching a regex' );
39 FIND_CLASS_BY_REGEX: {
40 my $x = $mech->find_link( tag => 'iframe', class_regex => qr/IFRAME$/i );
41 isa_ok( $x, 'WWW::Mechanize::Link' );
42 is( $x->url, 'http://boo.xyz.com/boo_app', 'found link with class matching a regex' );