+ All Categories
Home > Documents > Selenium Installation Guide

Selenium Installation Guide

Date post: 18-Nov-2014
Category:
Upload: kailashshankarchalla
View: 112 times
Download: 2 times
Share this document with a friend
Popular Tags:
13
Selenium installation Guide Selenium Remote Control You can download the Selenium Remote Control from the website given below. http://www.openqa.org/selenium-rc/download.action Latest version: Version 0.9.2 Steps to be followed 1. Unzip the folder to any specified location you want. 2. Go to the command prompt. 3. Type the command containing the path of the selenium server like cd C:\seleniumRC\selenium-remote-control-0.9.2-dist\selenium- remote-control-0.9.2\ selenium-server-0.9.2 Press enter. (Give the path in which you have kept your selenium) 4. Then type java –jar selenium-server.jar –interactive Press enter 1
Transcript
Page 1: Selenium Installation Guide

Selenium installation Guide

Selenium Remote Control

You can download the Selenium Remote Control from the website given below.

http://www.openqa.org/selenium-rc/download.action

Latest version: Version 0.9.2

Steps to be followed

1. Unzip the folder to any specified location you want.

2. Go to the command prompt.

3. Type the command containing the path of the selenium server like

cd C:\seleniumRC\selenium-remote-control-0.9.2-dist\selenium- remote-control-0.9.2\selenium-server-0.9.2 Press enter. (Give the path in which you have kept your selenium)

4. Then type java –jar selenium-server.jar –interactivePress enter

This will start the selenium server with allowing the user to write commands like….

Entering interactive mode... type Selenium commands here (e.g.: cmd=open&1=http://www.yahoo.com) 

1

Page 2: Selenium Installation Guide

We can also give directly by specifying all commands in one go, instead of giving it separately.

C:\>java -jar C:\seleniumRC\selenium-remote-control-0.9.2-dist\selenium-remote-control-0.9.2\selenium-server-0.9.2\selenium-server.jar –interactive

5. Now you are ready to type your command. Like which I have given below

If IE then type this command on the selenium server screen (command prompt)

If you want to use Firefox, try this:

cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com2

Page 3: Selenium Installation Guide

If all goes well, you should see a new browser window starting with the browser of your choice. Back in the Selenium Server command window, you should see the following message:

Got result: OK, 794468 on session 794468

NOTE: Each session will give different session ID and you have to replace the session ID with your session ID.

This command will open the selenium test runner with the corresponding session ID generated for that session.

The following window shows Selenium Test Runner.

3

Page 4: Selenium Installation Guide

If you want to do more then type the following commands to perform a google search

cmd=open&1=http://www.google.com/webhp&sessionId=794468

4

Page 5: Selenium Installation Guide

When thie following command finishes, your browser window should reveal google.com in the lower frame.

Then Type the below command for typing a search string in the search text box.

cmd=type&1=q&2=hello world&sessionId=794468

5

Page 6: Selenium Installation Guide

Now you can see that the “hello world” is displayed on the lower frame of the browser , which is shown below.

6

Page 7: Selenium Installation Guide

In order to perform the search,we need to click the search

Buttom,for that type the following command.

cmd=click&1=btnG&sessionId=794468

The corresponding result is obtained in the lower frame of the browser.

The window is shown below.

7

Page 8: Selenium Installation Guide

In order to get the name of the browser,just type the following

command on the command prompt.

cmd=getTitle&sessionId=794468

8

Page 9: Selenium Installation Guide

At any point of time, to shut down the server type control+c

Important Points:

Make sure you have java installed in your system version 1.5 or above. If you get any port related error then try changing the port number.

E.g. port<new port number>java -jar selenium-server.jar -port <a_free_port_number_like_4445>

If you get an error saying something like this,

HTTP ERROR: 400

Could not proxy http://www.google.com/webhpjava.net.UnknownHostException: www.google.com

RequestURI=/webhp

Powered by Jetty://

Then change the proxy settings or try without proxy.

For running Automation Scripts steps are given below.

Pre-requisite

1. Selenium RC

2. Jdk 1.5 or above

3. Junit or TestNG (I am using junit)

4. Set Class Path: Add Java class path, selenium class path and junit class path

Go to My Computer properties->advanced->Environment Variables-> System Variables

9

Page 10: Selenium Installation Guide

You will be having a class path variable, just need to add the new jar files to it.

Steps

1. Create a java file for running the simple Google search. You can record a Google test through Selenium IDE and then export it to java.

Name the file as GoogleTest.java and save in any location.

2. Compile the java code through command prompt.

Command for complication

c:javapath/javac filename.java

Make sure that you are in the path where you have saved the java file

10

Page 11: Selenium Installation Guide

3. Then in another command prompt start selenium server using the command given in step 3 to 4 in the steps to be followed.

Java –jar selenium-server.jar –interactive

4. Run the java file using the command java filename

This will start the selenium core and will perform the Google search (as per the program is intended to do)

Selenium IDE

This is used for record and play back.The installation is very simple. You can download the Selenium IDE from the website given below.

http://www.openqa.org/selenium-ide/download.action

11

Page 12: Selenium Installation Guide

Latest version: Version 0.8.7

Then go to the firefox Toolbar->extensions click on that, a window will open just drag and drop the selenium IDE to that window.

From that you can click on the selenium IDE, the window will appear on the screen.Which is shown below.

12

Page 13: Selenium Installation Guide

13


Recommended