Thursday, September 23, 2010

Installing Selenium RC:

Introduction:
It is surprising to notice that there are not many tutorials out there that gives step by step instructions to configure Selenium RC in NetBeans. Instead there are lot of tutorials on configuring Selenium with Eclipse. I had tough time finding one such tutorial and when I found something it was not for beginners. So I decided to document all my Learning's for my own reference as well as for anyone starting with Selenium RC with NetBeans IDE.
As much as possible, I will try to keep it step -by- step approach.If you have any questions Let me know and try my level best to answer it. If not you will have to Google it and find it somewhere else.

Getting Started:
First things first you need to download the following programs if you haven't done it already. So Download and save them in some place say My Documents.
  •  Download and Install latest version Java SE with NetBeans from HERE .(Its pretty straight-forward).
  •  Download and Install latest version of Mozilla Firefox.
  •  Download and save the zip files against the heading Selenium RC and Selenium IDE from HERE. (Selenium IDE just installs as an extension on Firefox)
Installing Selenium RC:
  • Unzip/extract and open the folder by name selenium-remote-control-1.0.3
  • Open cmd prompt (Start-->Run-->type cmd and click ok).
  • Go to the directory where selenium server folder is located (e.g cd Downloads\selenium-remote-control-1.0.3\selenium-server-1.0.3).
  • Type  "java -jar selenium-server.jar -interactive" in cmd prompt. If everything is ok then you should receive output something like below.
17:23:11.245 INFO - Java: Sun Microsystems Inc. 16.3-b01
17:23:11.245 INFO - OS: Windows XP 5.1 x86
17:23:11.245 INFO - v2.0 [a2], with Core v2.0 [a2]
17:23:11.620 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
17:23:11.620 INFO - Version Jetty/5.1.x
17:23:11.620 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:23:11.620 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:23:11.620 INFO - Started HttpContext[/,/]
17:23:11.698 INFO - Started
org.openqa.jetty.jetty.servlet.ServletHandler@17943a4
17:23:11.698 INFO - Started HttpContext[/wd,/wd]
17:23:11.714 INFO - Started SocketListener on 0.0.0.0:4444
17:23:11.714 INFO - Started
org.openqa.jetty.jetty.Server@dbe178
Entering interactive mode... type Selenium commands here (e.g: cmd=open&1=http://www.yahoo.com)
  • Still with me...Alright, Let see how to make the Selenium server file a batch file. Open a notepad and type the following commands.
  • @echo off
              java -jar selenium-server.jar -interactive
  • Save the  file as all files (not text file as shown below)
        (For further information on creating batch files refer to the links in  "Some useful Links to Other sites" tab

  • In the above step we have created a batch program for starting the Selenium server. Now go to the desktop , create a shortcut  and refer the shortcut to the batch file.So from now on we can start the selenium server from the desktop like any other program (Remember: The selenium server must be started before you could launch the tests from NetBeans...until we learn how to start selenium server from Java).
  • In this chapter we have successfully installed selenium RC and configured it to run from the desktop. Our next aim is to configure selenium RC in NetBeans IDE to  run Java tests from NetBeans. So click on " Configuring Selenium in NetBeans" tab to learn more.
    I will be adding more content in the forthcoming days. Please bare with me as I am trying to update this blog whenever I get some time.