Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Wednesday, June 9, 2010

Writing first test case in perl

I created a test script in perl
All it does is gets into amazon.co.uk & searches for a microscope verifies if the brand exists & clicks on that link.

use strict;use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*iexplore",
browser_url => "http://www.amazon.com/" );
$sel->open_ok("/");
$sel->type_ok("twotabsearchtextbox", "Microscope USB");
$sel->click_ok("//input[\@alt='Go']");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("Veho");
$sel->click_ok("link=Veho VMS004DELUXE USB Powered Microscope");
$sel->wait_for_page_to_load_ok("30000"); automationwithselenium.blogspot.com-Google pagerank and Worth

No comments:

Post a Comment