-
Notifications
You must be signed in to change notification settings - Fork 89
Getting Started with Selenium::Remote::Driver
aivaturi edited this page Mar 2, 2012
·
6 revisions
These instructions assume that you're working on Windows, but they'll work on other platforms too.
You should have the following installed on your system to get started:
- Perl (ActivePerl on windows is a better choice)
- Java
- Browsers that you want to automate (chrome, Firefox, Opera).
Make sure that you install all of the above in default locations. Things will be much easier if you stick to defaults.
There are two main components that you need to get the whole browser automation going:
- Selenium WebDriver Remote Server
- Perl bindings, which you will eventually use in your test scripts.
- Download Selenium standalone server from http://code.google.com/p/selenium/downloads/list. Look for a file named
selenium-server-standalone-XXX.jar
, where XXX is a version number like 2.20.0. For this exercise let us assume you have downloaded the server in to c:\selenium. - Start the server & see every thing works fine. To do that:
- launch command prompt & go to c:\selenium directory
- type ```java -jar selenium-server-standalone-2.20.0.jar"
- the console output should be something like this:
C:\selenium> java -jar selenium-server-standalone-2.20.0.jar
Mar 01, 2012 5:27:17 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
0 [main] INFO org.openqa.selenium.server.SeleniumServer - Java: Oracle Corporation 21.0-b17
1 [main] INFO org.openqa.selenium.server.SeleniumServer - OS: Windows 7 6.1 amd64
5 [main] INFO org.openqa.selenium.server.SeleniumServer - v2.20.0, with Core v2.20.0. Built from revision 16008
117 [main] INFO org.openqa.selenium.server.SeleniumServer - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
118 [main] INFO org.openqa.jetty.http.HttpServer - Version Jetty/5.1.x
119 [main] INFO org.openqa.jetty.util.Container - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
119 [main] INFO org.openqa.jetty.util.Container - Started HttpContext[/selenium-server,/selenium-server]
120 [main] INFO org.openqa.jetty.util.Container - Started HttpContext[/,/]
149 [main] INFO org.openqa.jetty.util.Container - Started org.openqa.jetty.jetty.servlet.ServletHandler@4f70a570
149 [main] INFO org.openqa.jetty.util.Container - Started HttpContext[/wd,/wd]
205 [main] INFO org.openqa.jetty.http.SocketListener - Started SocketListener on 0.0.0.0:4444
205 [main] INFO org.openqa.jetty.util.Container - Started org.openqa.jetty.jetty.Server@3a926c19
- If you're going to automate chrome, get the Chrome server from http://code.google.com/p/chromium/downloads/list. Look for a file named chromedriver_win_XXXX.zip, where XXXX is the version number (if you're not own win look for appropriately named file). Now extract chromedriver.exe in to c:\selenium. And now your selenium server command becomes:
java -Dwebdriver.chrome.driver="chromedriver.exe" -jar selenium-server-standalone-2.20.0.jar
- Install Selenium::Remote::Driver module from CPAN using your preferred method. But if this is the first time installing any modules from CPAN, you can do so in the following way:
- If you're using ActivePerl type the following on command line:
ppm install Selenium::Remote::Driver
- Or you can install directly via cpan from command line:
perl -MCPAN -e "install Selenium::Remote::Driver"
- If you want to install it directly from github, you can follow these steps:
- This assumes you have nmake & git installed
git clone git://github.com/aivaturi/Selenium-Remote-Driver.git
cd Selenium-Remote-Driver
perl Makefile.PL
nmake
nmake test
nmake install
To verify everything is setup correctly & working fine, get the example script included in this distribution (https://github.com/aivaturi/Selenium-Remote-Driver/blob/master/driver-example.pl) & run it. If you don't see any warnings or errors, you're good to go.