Monday 3 December 2012

Selenium – Setting up Selenium & Eclipse


Now its time to learn how to configure Selenium RC client driver with Eclipse IDE and how to run Selenium RC server instance.  We will try to understand this step by step.
Note: Download JDK ( from the Oracle / Sun website and install prior to installing Eclipse)
Download Eclipse
  1. Go to URL – http://www.eclipse.org/downloads/
  2. Select Eclipse IDE for Java Developers (Click on Windows 32 bit platform)
  3. Click on OK button and save to a local drive (i.e. C: or D:, etc)
  4. Unzip the downloaded zip file and rename that to Eclipse
  5. Create one more folder “Eclipse-Workspace” (i.e. C:Eclipse-Workspace)in the same drive where Eclipse is unzipped and renamed.
  6. Create Eclipse desktop shortcut (go to C:Eclipse folder –> right click Eclipse.exe and then click on “desktop create shortcut”) as demonstrated in the below pictures.
  1. Now we need to create a workspace folder –> C:Eclipse-WorkspaceSeleniumTests
  2. Double click on “Eclipse shortcut on Desktop”
  3. This opens the Eclipse
  4. Close Eclipse welcome screen
  5. Click File menu –> Switch Worspace –> other
  6. Now Select the C:Eclipse-WorkspaceSeleniumTests folder (These steps are demonstrated in the following figure)

We have finished setting up the eclipse.  Now, we need to download Selenium RC server / client driver and configure that to Eclipse
  1. Download Selenium server:  http://seleniumhq.org/download/ 
  2. Download Selenium Client driver for Java (from Selenium Client Drivers section)
  3. Create “Selenium” folder in C: drive and copy the Selenium-server.jar as well as unzip the Selenium Client driver (C:Selenium)
Downloading and unzipping the files into a folder is done.  We need to configure the appropriate Selenium Client driver Jar file to the Eclipse.
  1. Go to Eclipse –> Click  File –> New –> Project (from various options need to select just “project”)
  2. In Select Wizard –> Click Java –> “Java Project” (demonstrated in the below figure)

  3. Give the project name (e.g. SugarCRMTests)
  4. Click Finish – Click Yes
  5. Now we are done with creation of project and need to configure the Selenium Client driver to this Project
  6. Right Click “SugarCRMTests” project
  7.  
  8. Click “Java Build Path”
  9. Click Libraries tab
  10. Click “Add External JARs” button
  11. Select “Selenium Client Drivers” unzipped in C:Selenium folder (Selenium Server JAR file should not be added)
  12. Click OK
  13. Referenced libraries –> contains both the Selenium Client driver jar files as shown in the below picture.

So far we have learnt the following:
  1. Download latest JDK and install
  2. Download Selenium Server as well as Client drivers and unzip into a folder
  3. Download Eclipse and configure
In the next post we will learn how to execute selenium tests using Eclipse