Setting up Selenium with Perl

Here are the steps to configure Selenium with Perl.

1. Download Active Perl from the link: http://www.activestate.com/activeperl/downloads
2. Install the Perl using the installer.
3. Download Selenium RC Server from link: http://seleniumhq.org/download/
4. Right Click on My Computer > Properties > Advanced System Settings > Environment Variables.
5. Add/Edit new User Variable ‘PERL5LIB’ to have following path added to it: ‘D:\Automation\selenium-perl-client-driver-1.0.1\lib’

D:\Automation\selenium-perl-client-driver-1.0.1 here is the path to directory selenium-perl-client-driver-1.0.1 which comes bundled as part of Selenium RC Server download.

6. Now open notepad and copy the following script in it and save it e.g. say: firstScript.pl

use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";


	my $sel = Test::WWW::Selenium->new( host => "localhost", 
                                    port => 4444, 
                                    browser => "*firefox", 
                                    browser_url => "http://google.com");
$sel->open_ok("/", "true");

pass;

7. Open command prompt. Navigate to path where you have downloaded Selenium RC Server.
8. Change the directory to selenium-server-1.0.3
9. Execute the command java -jar selenium-server.jar
10. Open another command prompt. Navigate to the directory where you have stored your script.
11. Execute the command: perl firstScript.pl and here you are. Your first script will execute successfully.

Hope it helps.

Thanks,
Rajat Jindal
Quicksilver1183.com

Posted in Perl, Programming, Selenium/Webdriver, Tools
One comment on “Setting up Selenium with Perl

Leave a Reply

Your email address will not be published. Required fields are marked *

*