Click here to Skip to main content
13,199,852 members (65,998 online)
Click here to Skip to main content
Add your own
alternative version

Stats

19.9K views
19 bookmarked
Posted 13 Oct 2014

Getting started with Selenium

, 13 Oct 2014
Rate this:
Please Sign up or sign in to vote.
Selenium to start with for automation Testing in a simple and diagramatic approach..

Introduction to Selenium

Automated testing here means, using a software tool to run repeatable tests against the application to be tested. For example, when a site has 3 phases of registration to be tested for 1000 users. Entering so many records manually is not a bed of rose job. So, if it would have been possible to write scripts that would register for us 1000 users would sound great. Right!! There are many automation tools like TEST COMPLETE, WATIR, SELENIUM, etc. Here, we would be discussing about the Selenium. There are a lot of diagrams that I have mentioned in this article as diagrams explain the best.

Quote:

Selenium automates the browsers

Now, the above line is self-explanatory, that is we can understand here that Selenium is an automation tool that is used for automated testing the Web Browser. Selenium is an open source tool that is used both for function and regression testing for the web based applications, originally developed by "ThoughtWorks". It works with most of the browsers but mostly the following browsers:

                                                    

Languages Supported & O.S. supported

Along with this Selenium also works with multiple operating systems like:

  • Windows
  • Mac
  • Linux/UNIX, etc.

Selenium also supports multiple languages like:

  • Java
  • C#
  • Ruby
  • Pythn
  • Perl
  • Php

Mostly Java is the famous as it is platform independent. Another thing here worth to be noted is "It is not mandatory to write the Selenium scripts in the language in which the web application is written. It is not language specific. We can choose any of the language to write the Selenium scripts."

Tool Suites of Selenium

  1. Selenium IDE(Integrated Development Environment):
  •  Selenium IDE is an integrated development environment for Selenium tests.
  • Selenium IDE is a fire fox add-on that records clicks , typing and other actions to make test cases which tester can playback in the fire fox browser and export to Selenium RC.
  • Selenium IDE has the following features: record/ playback feature, debugging with step by step and break points.
  • Selenium IDE allows you to save tests as HTML, Java, Ruby scripts, or any other format. Allows you to add selenese commands as and when required.

2. Selenium RC(Remote Control):

  • A solution to cross browser testing.
  • A server, written in Java and so available on all the platforms.
  • Acts as a proxy for web requests from them.
  • Client libraries for many popular languages.
  • Bundles Selenium Core and automatically loads into the browser.
  • Selenium RC is used to enhance your script.

3. Selenium Grid:

  • Selenium-Grid allows the Selenium-RC solution to scale for test suites or test suites to be run in multiple environments.
  • With Selenium-Grid multiple instances of Selenium-RC are running on various operating system and browser configurations, each of these when launching register with a hub. When tests are sent to the hub they are then redirected to an available Selenium-RC, which will launch the browser and run the test.
  • This allows for running tests in parallel, with the entire test suite theoretically taking only as long to run as the longest individual test.

4.Selenium Web Driver:

  • WebDriver is designed in a simpler and more concise programming interface along with addressing some limitations in the Selenium-RC API.
  • WebDriver is a compact Object Oriented API when compared to Selenium1.0.
  • It drives the browser much more effectively and overcomes the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier

Installation

Steps to configure Selenium Web driver:

  1. Step 1: Download and Install Java (JDK-Java Development Kit) into your system
  2. Step 2: Download Eclipse into your system. From the downloaded Eclipse folder click the "eclipse.exe".
  3. Step 3Download the language specific client drivers. Selenium Client and WebDriver Bindings From here download the Java client version, click on the version mentioned to directly download from here- "2.43.1". A zip file will be downloaded, thus Extract all the files and then we find that there are: "libs" folder, 2 jar files and Change Log.
  4. Step 4: Now, we need to configure Eclipse  to integrate with the web driver. For that, Double click on the "eclipse.exe". Select a workspace folder,that is create a folder in any of the drive and select that.
  5. Step 5: Now we create a new java project..."File -> New -> Java Project" or "ctrl+N" -> Select on Java Project -> Next -> Give a Project name-> Click Finish.

    

 Then after creating the project there will be the project structure on the left panel as on the above image.

6. Step 6 : Now create a Package.For package creation, right click on the SRC of Test_Project-> New ->Package and name that package as – package_1. By convention, package names usually start with a lowercase letter. Under one project, more than one package can be created.    

7.  Now create a Java Class.For Class creation, right click on the Package i.e " package_1" -> New ->Class and name that class as "class_1". By convention, Class names usually start with an uppercase letter. Under one package, more than one class can be created.  

8.  Now Configure the JAR files that have been downloaded in Step 3.For adding the JAR files into the project ["Test_Project"],click project 'Test_Project' -> Properties -> Select Java Build Path-> Libraries Tab ->Click On Add External Libraries button .

OR

Click on ‘Test_Project’ -> Build Path -> Configure Build Path ->  Select Java Build Path present on the left column -> Libraries Tab  -> Click On Add External Libraries button.

9.  Now select two JAR files present in the folder "selenium-2.43.1 ".  Select two JAR files present in the folder”selenium-2.43.1 “. Now click on Open.

 

10. Then again click on the External Jars. Open the Libs folder and select all the JAR files present there and click on OK. 

11. Now all the Required jar files  are added under the Libraries Tab. Now then click on OK.

12. Now all the Jar files are added under the JRE system Libraries. Below is the view of the structure:

Conclusion

In this article, I have covered the Installation and basics of automation testing using Selenium. Selenium is one of the most commonly used tool for automation testing. In the upcoming articles, I will be covering up with the script codes and practical usage of Selenium. Hope beginners in testing would get to learn basics of Automation testing in selenium from this. Any queries and suggestions are most welcome. :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sipra Ray
Tester / Quality Assurance
India India
I am Sipra Ray, ISTQB certified - Quality Analyst at Mindfire Solutions.
An extrovert by nature ,I like to interact with people and share with all what I learn.
I would love to share and answer queries and gain knowledge from forums like Code Project
Follow up with my blogs at:- siprabugtracker.wordpress.com

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionSelenium WebDriver Tutorials Pin
Naira kapoor3-Jan-17 6:22
memberNaira kapoor3-Jan-17 6:22 
QuestionRight click in Selenium Builder Pin
Member 1156964831-Mar-15 1:00
memberMember 1156964831-Mar-15 1:00 
QuestionThank you Pin
thileep201028-Feb-15 7:19
memberthileep201028-Feb-15 7:19 
AnswerRe: Thank you Pin
Sipra Ray10-Mar-15 19:33
memberSipra Ray10-Mar-15 19:33 
GeneralThank You...Keep Up The Good Work! Pin
Member 1134291229-Dec-14 22:14
memberMember 1134291229-Dec-14 22:14 
QuestionHi Pin
Nimesh Lakhani11-Nov-14 23:01
memberNimesh Lakhani11-Nov-14 23:01 
Questionnice and crisp Pin
Priyank Sharma7-Nov-14 18:09
memberPriyank Sharma7-Nov-14 18:09 
AnswerRe: nice and crisp Pin
Sipra Ray9-Nov-14 21:17
memberSipra Ray9-Nov-14 21:17 
QuestionReally Nice Pin
Suraj Sahoo Mindfiresolutions13-Oct-14 22:59
groupSuraj Sahoo Mindfiresolutions13-Oct-14 22:59 
AnswerRe: Really Nice Pin
Sipra Ray14-Oct-14 2:21
memberSipra Ray14-Oct-14 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 14 Oct 2014
Article Copyright 2014 by Sipra Ray
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid