Wednesday, December 28, 2011

Selenium Installation Steps


  1. Download and install JDK 1.7 in D:\Program Files\Java\jdk1.7.0
  2. Add Environment Variable (Right Click My Computer → Advanced → Environment Variables) for JAVA_HOME.
  3. Include in path, JAVA_HOME\bin.
  4. Include in  Classpath, JAVA_HOME\lib\rt.jar.
  5. Download and extract JUnit.
  6. Download and extract Apache commons logging jars.
  7. Install FireFox.
  8. Set path to Firefox\bin in Environment Variables.
  9. Create profiles for Firefox using “firefox.exe –profilemanager”.  Note: Profiles should be created in a different folder, i.e. other than the default folder.
  10. Download Selenium IDE.
  11. Add Selenium IDE as FireFox plug-in
  12. Download and extract Selenium Java Client drivers.  Add the extracted jars to the Classpath variable.
  13. Download and extract Selenium Server Standalone Server.  Add the server jar to the Classpath variable.
  14. Download and extract Logging Selenium.
  15. Install Notepad ++ for creating and editing bat files.  E.g. runServer.bat.  Below are few points to note:
a.      Create a Test Suite (TestSuite.html) and include the test cases (TestCase1.html) exported using Selenium IDE.  We cannot execute a test case directly.
Command is:
 java –jar selenium-server-standalone-2.4.0.jar -multiwindow -htmlSuite "*iexplore" "http://www.bing.com" "D:\Work\Haritha\TestSuite.html" "D:\Work\Haritha\TestResults.html”

  1. Install IntelliJ - Community Edition for writing automated scripts / program for JUnit (Web Driver, Web Driver Backed and Remote Control).  Below are few points to note:
a.      Include all the above jars (JUnit, Apache commons logging, Selenium Java Client driver jars, etc) including Selenium server jar to the to the global references (Add External Jars).
b.      To execute any Selenium JUnit code, keep the Selenium Standalone Server in start state.  E.g. runServer (Shortcut placed on desktop)
Command is:
 java –jar selenium-server-standalone-2.4.0.jar -multiwindow
c.       Create package com.example.tests in the JUnit project.   Exported code (TestCaseRC.java) from Selenium IDE should be placed in this package.


References:
1. Code Examples are shared in GitHub (https://github.com/gudiseva/Selenium.git)
2. I have used Abyss Web Server to test these Selenium examples (http://www.aprelium.com/abyssws/)

---