First Step Towards Selenium for Beginners

  • By
  • September 25, 2019
  • Software Testing
First Step Towards Selenium for Beginners

First Step Towards Selenium for Beginners

As we have already seen the brief introduction of manual and automation testing in my previous blog “Introduction to Software Testing.So continue this discussion we are moving towards automation tool i.e Selenium.

Selenium is a suite of web browser automation tools to automating web browsers across different platforms. It’s primarily used for automating web applications for testing purposes, although it’s capable of much more. You might be surprised:  How can a Selenium tool improve your development and testing processes?

Most of the big-name browser vendors support it. And many of these vendors either have taken or are taking steps to make Selenium a native component of their browsers. Additionally, it is the core technology used in a variety of other browser automation tools, APIs, and frameworks.

Selenium supports different browsers and different operating systems and runs on a variety of programming languages and testing frameworks can control it. Also, Selenium can automate tedious web-based administration tasks.

For Free Demo classes Call: 9028414448
Registration Link: Click Here!

Selenium comes into two different forms:  

1) Selenium WebDriver, which enables developers to scale and distribute test scripts across many different environments and create browser-based regression automation suites and tests

2)  Selenium IDE, an integrated developer environment useful for creating quick bug reproduction scripts and for exploratory testing aided by automation. Selenium WebDriver is the successor to the now-deprecated Selenium Remote Control (RC), and coupled with Selenium 1.0, comprises the current version, Selenium 2.0.

Most developers get started with Selenium IDE. This helps with gaining familiarity with Selenium commands. Using Selenium IDE, developers can create simple test cases rapidly – sometimes within mere seconds. However, Selenium is developers do not recommend using Selenium IDE for all testing automation purposes. They suggest building test scripts using Selenium 1.0 or Selenium 2.0 along with one of the supported programming languages. Since Selenium 2.0 is the version that will continue to be supported going forward, if you are new to Selenium, you will want to opt for Selenium 2.0.

Selenium is mainly divided into four different components:




Setting Up Projects in Selenium 2.0 (a.k.a. Selenium WebDriver)

The aim of Selenium WebDriver is  to overcome the limitations of the previous Selenium Remote Control (RC), It offers better support for dynamic web pages where the elements on a web page are subject to changing without the  reloading page itself. Because a different of browsers support it, Selenium WebDriver uses each browser’s native support for automation. Thus, the features supported by webdriver and the direct calls are made depends on the browser that you are using.

Additionally, the way that you will set up a Selenium WebDriver Project depends on both your programming language and your development environment. It is possible to set up projects using several programming languages (PL) as follows:

  • Java: These projects are most easily setup using Maven, which will download Java bindings and all dependencies and create the project for you.
  • C#: C# bindings are distributed as part of a set of signed  Dynamic Link Library(dlls) and dependency dlls. You can download the latest selenium-dotnet zip file. Then, you will need to add a reference to each unzipped Dynamic Link Library (dll) to your project in whatever IDE you’re using.
  • Python: Run Pip Installs Packages in selenium from a command line to add Selenium to a Python environment.

For Free Demo classes Call: 9028414448
Registration Link: Click Here!

NOTE-  Pip is one of the most famous and widely used package management system to install and manage software packages written in Python and found in Python Package Index (PyPI). 

  • Ruby: Run gem Installs Packages, install selenium-webdriver from a command line to add Selenium to your Ruby environment.
  • PHP: PHP bindings are also available through third parties, including Chibimagic, Lukasz Kolczynski, and Facebook.
  • JavaScript:  The Selenium Project provides JavaScript bindings on Node Package Manager (npm). Install them by running npm install selenium-webdriver.

Once you have a set up of your project, Selenium WebDriver functions just like a normal library. It is self-contained and typically does not require you to start additional processes or run any installers before using it. There are some exceptions, which requires additional setup steps required for following browsers:

  • ChromeDriver
  • Opera Driver
  • Android Driver
  • iOS Driver

Creating and Editing Test Cases Using Selenium IDE

The Selenium IDE is the tool to develop your test cases. It is a Firefox plugin that is easy to use, containing a time-saving context menu and Selenium IDE command options that make the process of learning Selenium script syntax simple ans easier.

Once you have installed Selenium IDE in Firefox, it is available in the Firefox Tools menu. Selecting it will open a new, empty script-editing window as well as a menu for creating test cases. From there, you can use one of three methods to build test cases (often, you’ll need to use all three):

  1. Recording test cases: This records a test case based on interactions with a website. By default, the record button is off when Selenium IDE is opened, but you can turn this on whenever you want to start recording. During recording, Selenium IDE automatically inserts commands based on actions you had in web browser, such as clicking on some link (the click or click and wait command), open browser, entering values i.e input fro user, selecting options from a drop-down menu (select command), or clicking checkboxes or radio buttons (the click command).
  2. Adding verifications and asserts: This process enables your test to check the properties of a web page using the assert and verify. To use this, right-click anywhere on the web page in the browser displaying test application and choose from the assert and verify options in the context menu. More commands get added to this menu as you continue to use Selenium IDE, which attempts to predict what command and parameters you will need for an UI element on a web page. 
  3. Editing: You’ll also likely encounter the need to edit test cases and manually insert or edit commands and comments. In the table view which is display on IDE tool, simply select the point in your test case where you want to insert a command, right-click, and select insert command. Selenium IDE adds a blank line ahead of your selected point where you can use the command editing text fields to enter a new command. In source view, the process is similar: select the line where you want to enter the new command, left-click between the commands in the test pane where you want to enter it, and enter HTML code to create a three-column row with the command, the first parameter (if required), second parameter (if required to locate an element), and third parameter (if required to have a value). You can also enter comments throughout your test cases; these will be ignored when the test case is run.

Running Test Cases in Selenium IDE

Running test cases in Selenium IDE is just as simple task as setting them up. There are many options for running a test case as follows:

  • Running a test case (TC): Simply click the “Run” button to begin running the currently displayed test case.
  • Running a test suite (TS): Click the “Run All” button to run all test cases in the test suite currently loaded.
  • Stop and start: Use the “Pause” button to stop a test case .
  • Stop in the middle: This option enables you to set a specific breakpoint that stops a running test cases at a particular command. Setting a breakpoint is easy; just select a command, right-click, and then choose “Toggle Breakpoint” from the context menu.
  • Start from the middle: Similar to stopping a test case at a certain command, you can also set a test to begin running from a specific command. The process for setting this point is the same as above, but instead of choosing “Toggle Breakpoint,” you willselect “Set/Clear Start Point” from the context menu.
  • Running a single command: Double-click on any command to run test case, a useful tool for testing a command while you are constructing it.

With Selenium IDE component, you can also use a base URL to run test  in various domains by specifying a relative URL instead of an absolute URL to open a test case.

For Free Demo classes Call: 9028414448
Registration Link: Click Here!

To define a test suite, a collection of test cases that you want to run as a continuous sequence, you can use a simple HTML file or config file to define your list of tests. Each row in HTML file should define the file system path to the tests you want to include in the suite.

Once you have mastered the basics of Selenium, you will find tons of ways you can put these tools to use to improve development and testing processes. With many advanced features and functionality in selenium, beings quite simple for beginners to begin using and master, Selenium is a valuable suite of tools for experienced developers alike. The Selenium Wiki on GitHub is a useful source for learning many advanced capabilities of IDE tool offers.

How to Write Your First Script in Selenium WebDriver

Selenium WebDriver is one of the most popular frameworks for web automation. To get more from your Selenium WebDriver tests there are many test frameworks, services, and libraries, which can help you to organize your tests, monitor their execution, and provide comprehensive reports. 

The architecture of selenium webDriver is as follows:-

Write Script

For Free Demo classes Call: 9028414448
Registration Link: Click Here!

Getting Started With Selenium WebDriver Scripting

Assume that you want to write the test script in Selenium Webdriver that could as following steps:

  • open the browser (chrome browser)
  • Maximize the browser
  • enter URL

Close browser

Coding 1

Coding 2


Name: Revati  Raspayle
Sevenmentor Pvt Ltd

Call the Trainer and Book your free demo Class for now!!!

call icon

© Copyright 2019 | Sevenmentor Pvt Ltd.

One thought on “First Step Towards Selenium for Beginners

Submit Comment

Your email address will not be published. Required fields are marked *