To Install:
Install JRE from Go to http://www.java.com/en/download/manual.jsp to download the installation file.
To check, If its already Installed:
• Click on Start
• Click on Run…
• Type in cmd and click Ok
• Type in java –version and push Enter
If you have JRE installed it will echo back with version number somthing like this:
java version "1.5.0_07"Download:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)
Go to http://selenium-rc.openqa.org/download.html and download the zip file.
After downloading, extract the files to C: driver directory.
1. Right Click on the zip file you just downloaded
2. Click on Extract All...
3. Click Next
4. Click on Browser…
5. Click on My Computer
6. Click on Local Disk (C:)
7. Click on OK
8. Click on Next
9. Click on Finish
Now Selenium files are ready to be used.
Set up Selenium directory to your environment path:
To add Selenium to your Windows environment take the following steps:
1. Click on Start
2. Right Click on My Computer
3. Click on Properties
4. Click on the Advanced tab.
5. Click on Environment Variables
6. On the upper half there should be a Variable named PATH
a. If you located it, double click on it, and add this value at the end of what is already in “Variable value”:
C:\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1\selenium-server.jar
b. If you do not located it, do this:
i. Click on New
ii. For Variable name: enter: PATH
iii. For Variable value: enter:
C:\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1\selenium-server.jar
iv. Click on OK
7. Click on OK
8. Click on OK
Now you have finished setting up the environment, the next step is to run a few selenium commands.
Ok now we are going to run some basic selenium commands from the command line.
To start off lets first open the command line window:
1. Click on Start
2. Click on Run…
3. Type in cmd
Now that the command line window is open lets try some basic Selenium commands as mentioned on the Selenium tutorial page (http://selenium-rc.openqa.org/tutorial.html)
• First we need to start up Selenium, we do this by typing in the following:
java -jar C:\selenium-remote-control-1.0-beta-1\selenium-server-1.0-beta-1\selenium-server.jar -interactive
• Now that Selenium is up and running we can run some Selenium commands.
To open up Internet Explorer and go to Google, you need to first create a Browser session. A Browser session is what selenium will use to target the browser and execute its commands.
To create a Browser Session type in the following command and push Enter
cmd=getNewBrowserSession&1=*iexplore&2=http://www.google.com
• After you execute this command, wait a few second to allow Selenium to run its course. By the time it has finished executing, a new browser should have opened up.
Now going back to the command line, you should see the following statement as the last line printed out:
Got result: OK, on session
Remember that you will not have the same session number as the one shown above. As long as it has the same format:
Got results: OK,
You are fine.
If you don’t get this message, make sure you typed in the command correctly, and if you are still having trouble, visit the Selenium website for help with troubleshooting.
• Now that you have your session and browser up and running, it is time to go visit the Google website. To do this type in the following command with your session number;
cmd=open&1=http://www.google.com/webhp&sessionId=
EXAMPLE:
cmd=open&1=http://www.google.com/webhp&sessionId=
No comments:
Post a Comment