Popular Posts

Wednesday, 2 March 2011

Selenium Grid Example - Part1

Contents
  1. Selenium grid with examples
  2. Prerequisite
  3. Working with demo of selenium grid
  4. Nice example of Selenium Grid with Testng
  5. Nice Example of Selenium Grid with Junit
Pre-requisite

1) JDK (Java Development Kit): Download the JDK from http://www.filewatcher.com/m/jdk-1_5_0_11-windows-i586-p.exe.53394464.0.0.html link.
After finishing the download, install the executable file into your system.
Set Java home as Environmental variable into your system, see screen:



User can see the above screen if he follows the following steps:
a) Right click on the My Computer icon from your desktop
b) Click Properties
c) Click Advanced tab
d) Click Environment Variables button
e) User would see Environment Variables interface
f) Click New associated with System variables section
g) You would see New System Variable interface
h) Put JAVA_HOME into the variable name field
i) Path of your JDK into the variable value field, as into the above screen my JAVA Home directory is installed into C:\Program Files\Java\jdk1.5.0_11
j) Click Ok
User can check if java is successfully installed on the system or not, follow two screens which are below:

Run java –version command into the command prompt like:


After execution of above command you would see the following screen:


2) Ant as build tool: Download the binary distribution of Ant from http://ant.apache.org/bindownload.cgi link.
After finishing with download, unzip the zipped file into directly your C:\Program files and put the same folder into the C:\Program Files\JAVA folder as well. See the screen:



Set ANT home as Environmental variable into your system, see screen:

User can see the above screen if he follows the following steps:
k) Right click on the My Computer icon from your desktop
l) Click Properties
m) Click Advanced tab
n) Click Environment Variables button
o) User would see Environment Variables interface
p) Click New associated with System variables section
q) You would see New System Variable interface
r) Put ANT_HOME into the variable name field
s) Path of your ANT into the variable value field, as into the above screen my ANT Home directory is installed into C:\Program Files\apache-ant-1.7.1
t) Click Ok
u) In the System Variables you would see variable Path, select the row, click Edit and define two paths(C:\Program Files\apache-ant-1.7.1\bin, C:\Program Files\java\apache-ant-1.7.1\bin) like into the following screen, in my case path of ANT bin folder is C:\Program Files\apache-ant-1.7.1\bin
v) Click OK


User can check if ANT is successfully installed on the system or not, follow two screens which are below:

Run ant –version command into the command prompt like:




Place the tools.jar file into your JRE\lib folder (as in our case path of lib folder is “C:\Program Files\Java\jre1.5.0_11\lib”), if you don’t do that then you would get the below screen else you would get next screen just after the below screen:

So ultimately if ant is successfully installed on your system then you get “Apache Ant version 1.7.1 compiled on June 27 2008” type of message, version and date will be according to yours ant version and compiled date.

3. Selenium Grid: Download the selenium Grid from http://seleniumhq.org/download/ link.
Unzip the downloaded file into C:\Program Files folder.
a. Launch the Selenium Grid hub, see the following two commands to perform the task:


b. Now after executing the command, user would see that selenium Grid hub is now launched on user’s system, user can verify the selenium hub if he launches http://localhost:4444/console into the browser , see the following screens:


c. Selenium Grid Hub before launching any remote control server:


d. For execution of Demo parallel, user needs launch multiple instances of selenium rc, please see the following commands to launch remote controls:

Ant –Dport=5555 –Denvironment=”*firefox” launch-remote-control
Ant –Dport=5556 –Denvironment=”*firefox” launch-remote-control
Ant –Dport=5557 –Denvironment=”*firefox” launch-remote-control
Ant –Dport=5558 –Denvironment=”*firefox” launch-remote-control

Execute the above commands into different-different terminals to launch multiple instances. I show you one example into one terminal, what I would like you to perform the same task into four different terminals on different-different ports:


Selenium Grid Hub after launching remote control servers:


here is the embedded video file:

SeleniumGrid_Example_Part1
Uploaded by vipingupta. - Discover more science and tech videos.

4 comments:

Related Posts Plugin for WordPress, Blogger...