Hi All, I'm trying to automate a test case where from a site map page, I need to get all the links and verify that clicking on the links is successful, for each link.
Here's the code I've written and it works well, ( below is the relevant part of the code ( I have used strict, warn)) ============================================================= my $result = 1; #assuming test success, will be reset to 0 on failure. my @links = $mech->find_all_links(); my @logout_links = $mech->find_link ( text=> 'logout' ); my $link_num; for ( $link_num = 0; $link_num <= $#links; $link_num ++ ) { if ( $links[$link_num] != $logout_links[0] ) { $mech->get( $links[$link_num] ); if (!( $mech->success )) { $result = 0; } } } if ( $result ) { print "Test case 1 Passed\n"; } else { print "\tAccess to one or more site map links failed.\n"; print "Test case 1 Failed\n"; } ============================================================= In case of failed links I want to print which link failed, tried printing as below (within the loop) $links[$link_num]->text() $links[$link_num]->url() ($links[$link_num])->text() ($links[$link_num])->url() But they just show the text string text/url , not the actual link. Kindly help me figure out how I can do this! Dhanashri