Here, we’ll discuss how to set up and configure Eclipse to use it for the java version of selenium RC. So prior to set up, let’s make sure we have all the required components gathered with us and the latest version of java installed in our system. The components required are as below.
- Latest version of Eclipse: This can be downloaded from http://www.eclipse.org/downloads/
- Selenium RC components: The version for selenium RC is 1.0.3 which can be downloaded from http://code.google.com/p/selenium/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount and the file name is selenium-remote-control-1.0.3.zip.
- Latest version of junit: This is available at https://github.com/KentBeck/junit/downloads
With these components in place we are all set to configure eclipse to do scripting using selenium RC. The following steps are to be followed for configuring eclipse.
Step 1: Extract Eclipse
Extract the content of eclipse package to your preferred location. Let’s assume here, that the contents are being extracted to C drive of your computer. Since eclipse is a fully fledged package, we need not worry about installing the same. Just extraction is sufficient. Now let’s launch eclipse by double clicking the eclipse icon inside the eclipse folder.
Step 2: Create workspace
After launching eclipse, a prompt appears to use a workspace. A custom workspace can be created using the browse button and creating a new folder. Name that new folder for convenience and select the same and click OK. Now you will be navigated to the home screen of Eclipse. There, we need to click on workbench which will take us to the work area.
Step 3: Create the project and project specific folders
Once we are in the work area, we need to create a project which will contain our scripts. To do so, click on File – New – Java Project as shown in the image below.
Once you click on the Java Project, a pop up window appears to set the parameters of your project.
Provide the name of the project in Project Name field and make sure it uses the latest execution environment. Click on Finish button and the project is created. Once the Project is created you will see it in package explorer on the left side. By expanding the project the there will be one default “src” folder created and it will have the JRE system library files associated to the project. We need to create one additional folder inside the project to hold the library files for our convenience. To do that, right click on the project folder in the package explorer and click on New – Folder.
It will open a pop up window where we need to specify the folder name. Let’s call the folder as “lib”. Once the lib folder is created, navigate to the physical location of the folder. Remember where you had created the Workspace in Step 2. Navigate to that folder, and the project folder can be located there. Once you are inside the lib folder place the library files inside it. What all library files to place? They are as follows:
- selenium-java-client-driver.jar
- selenium-server.jar (The Java Version)
- junit-4.8.2.jar
Now go to eclipse again and hit refresh on the lib folder by clicking the folder and pressing F5 key. You will now be able to see the library file.
Step 4: Configuring the Build Path
To use the library files placed inside the lib folder they need to be added to the build path of the project. How to add them? Right click on the lib folder in package explorer and select Configure Build Path from Build Path.
Once you click the same one pop up window comes up as shown below.
In this pop up window click on Libraries tab and click on the Add JARs button. Now navigate to the lib folder inside your project and select all the JAR files and add them.
Once you add them, click on OK. Now the build path is configured and the project is ready to be used.
Your final package explorer should look as below.
Now to do your scripting you will need to create one class file by right clicking the src folder and do the coding.
NB: there are few more steps to be followed when we are going to use testing and data driven approach which will be covered in later posts.
The post is very useful for anyone to get started with eclipse and selenium
Thanks Dipanshu 🙂
Thanks for posting. That was really useful for beginners like me
Lakshmi
Thanks Lakshmi. Please stay updated and you can post your doubts.
Sudeep,
This post contains very crisp and detailed information 🙂
All-in-All..this is a 1 stop guide for beginners who want to start off with setting up Eclipse for Selenium RC..
Thanks Rakshit
very helpful thanks buddy
Welcome 🙂
Very Useful Info @ One Go!! Thanks for sharing!!
Hi Sudeep,
Please confirm whether the above setup is sufficient to run tests.
I could see at the end of post saying “NB: there are few more steps to be followed when we are going to use testing and data driven approach which will be covered in later posts.” ~ What for is this? Can you explain a little or refer me to the later posts?
Thanks in advance!
Hi Kadhar,
To begin with selenium this is sufficient. Instead of downloading old selenium you can download the latest one from seleniumhq.org. You download the Java client drivers and put them to your classpath. You are good to go. For data driven testing, you will need jar files for testNG and jxl. You can refer the Hybrid Testing framework post.
[…] you do not have Eclipse installed in your machine, then you can get it from here and Install […]
Thank you very much for the details 🙂