Thursday, January 16, 2014

Setting up Selenium & Eclipse

Configure Selenium with Eclipse:
1. Go to URL – http://www.eclipse.org/downloads/
2. Download Eclipse IDE for Java Developers (Click on Windows 32 bit platform)
3. Unzip Eclipse and double click Eclipse.exe
4. Create a workspace folder –> C:\Workspace (or)
5. Click File menu –> Switch Worspace –> other
6. Now Select the C:\Workspace folder.
7. Click Workbench.

Download Drivers
Now, download Selenium RC server/client driver and configure that to Eclipse.

1. Download Selenium server
2. Download Selenium Client driver

Configure Selenium Client driver
 1. Go to Eclipse –> Click File –> New –> Project (from various options need to select just “project”)
 2. In Select Wizard –> Click Java –> “Java Project”
 3. Give the project name (e.g. TestProject)
 4. Click Finish.
 5. Create a folder named “lib” inside the project "TestProject".
 6. Copy the jar file "Selenium-server.jar" into "lib" folder.
 7. Also extract all the jar files from "selenium-java-x.xx.x" (Selenium Client driver) into "lib" folder.
 8. Right Click the project, “TestProject” and click "Build Path".
 9. Select "Configure Build Path".
 10. Click Libraries tab
 11. Click “Add External JARs” button
 12. Now, select all the jar files copied under the "lib" folder.
 13. Click OK
 14. Check the Referenced libraries for both the Selenium Client driver jar files.

Create class file

1. Right click on the folder "src", Click  File –> New –> Package
2. Name the Package. (e.g., testpack) and click Finish.
3. Right click on the Package and Click  File –> New –> class
4. Name the class. (e.g., Test)
5. Now write the script and run it.

No comments:

Post a Comment