Thursday, December 29, 2011

Selenium 2.0 / Web Driver and Eclipse



Steps to set up web driver and Eclipse:
  1. Open Eclipse from the menu choose File, New, Project...
  2. In the folder Java, choose Java Project.
  3. Give project a name, accept the rest of the defaults, and click Next.
  4. Download the latest zip file for selenium frm : http://seleniumhq.org/download/
  5. The latest version right now is : "selenium-java-2.15.0.zip"
  6. Unzip the files into the project that you just created
  7. Back in Eclipse, right click on your project in the Package Explorer and choose Build Path, Configure Build Path.... Choose the Libraries tab
  8. Click Add Jars
  9. Select all of the jars that you just unzipped into the /lib/selenium-jars/ folder and click OK
  10. Choose the primary selenium jar, which in this example is selenium-java-2.15.jar , expand and  double-click on Javadoc location. (Enter the location for the Selenium JavaDocs into the Javadoc location path field htttp://selenium.googlecode.com/svn/trunk/docs/api/java/)
  11. Click Ok and u are ready.
  12. Right click on the /src folder in your project and choose New, Package...Give the package a name and click Finish.
  13. Right click on the package and choose New, Class...Give the class a name and accept the other defaults, but make sure that public static void main(String[] args) is checked.
  14. Add code from selenium IDE in JUnit4 (WebDriver) format 
  15. Run the test :)
Happy Testing!!! 

0 comments: