Suppose that JRE(Java Runtime Envrioment), Test::WWW::Selenium, Selenium::Remote::Driver have installed in your computer.
1. Download selenium IDE and selenium server (selenium-server-standalone-2.25.0.jar) from
2. Write a script from Selenium IDE and save as Perl script which looks like below
- use strict;
- use warnings;
- use Time::HiRes qw(sleep);
- use Test::WWW::Selenium;
- use Test::More "no_plan";
- use Test::Exception;
- use Selenium::Remote::Driver;
- my $sel = Test::WWW::Selenium->new( host => "localhost",
- port => 4444,
- browser => "*iexplore",
- browser_url => "" );
- $sel->open_ok("/");
- $sel->click_ok("link=Chapter2");
- $sel->wait_for_page_to_load_ok("30000");
- $sel->click_ok("id=but1");
3. Start up Selenium RC Server by run the command java -jar selenium-server-standalone-2.25.0.jar
4. Run perl test case and the output should appear similar to the following code:
- E:\selenium\test>ff.pl
- ok 1 - open, /
- ok 2 - click, link=Chapter2
- ok 3 - wait_for_page_to_load, 30000
- ok 4 - click, id=but1
- 1..4
阅读(695) | 评论(0) | 转发(0) |