0% found this document useful (0 votes)
46 views

Software Testing: Selenium (Eclips IDE)

The document discusses Selenium, an open-source tool used for automating web browsers. It has several components that help with designing and developing automation frameworks, including Selenium IDE, Selenium RC, Selenium WebDriver, and Selenium Grid. Selenium allows testing of web applications through various types of tests. It has capabilities like supporting many programming languages, browsers, operating systems, and frameworks. Locators are used to identify elements in Selenium and various locator types are discussed. User interactions that can be automated include text boxes, radio buttons, checkboxes, dropdowns, keyboard/mouse actions.

Uploaded by

Anchal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Software Testing: Selenium (Eclips IDE)

The document discusses Selenium, an open-source tool used for automating web browsers. It has several components that help with designing and developing automation frameworks, including Selenium IDE, Selenium RC, Selenium WebDriver, and Selenium Grid. Selenium allows testing of web applications through various types of tests. It has capabilities like supporting many programming languages, browsers, operating systems, and frameworks. Locators are used to identify elements in Selenium and various locator types are discussed. User interactions that can be automated include text boxes, radio buttons, checkboxes, dropdowns, keyboard/mouse actions.

Uploaded by

Anchal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

SELENIUM

(Eclips IDE)

INTRODUCTION

Software Testing is an integral part of SDLC, and sometimes it involves a lot of repetitive tasks,
combing over scenarios over and again. Now to reduce these repetitive efforts, software testers
need the help of some tools which can enable them to automate these repetitive tasks. One of the
great suites of automation tools is Selenium, which provides the capabilities to automate user
actions on a web application. It is an open-source umbrella project for a range of tools and
libraries that enable and support the automation of web browsers.

Selenium
Selenium is an open-source tool that automates web browsers. It provides a single interface that
lets you write test scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python,
and C#, among others.

Selenium is not just an automation tool. It is a suite of tools, and each tool in the suite have
specific unique capabilities that help in designing and development of automation framework.
All these components can be either used individually or can be paired with one another to
achieve a level of test automation.

Selenium has become one of the most popular tools for automating web applications with a big
community behind it supporting. There are many types of testing that can be done with
Selenium. You can do smoke testing, sanity, testing, UI testing, regression testing, and more.
Components of Selenium are;

Courtesy: https://www.toolsqa.com/selenium-webdriver/selenium-testing/
1. Selenium IDE is an extension available for both Firefox and Chrome, which has the
record and replay functionality available. Selenium IDE also now has the capability of
exporting the code in various predefined languages. It also gives the ability to use one test
case inside another.

2. Selenium RC is a server that acts as a middle man between the user and the browser that
needs to interact. RC uses Javascript to work with browsers while allowing the users to
write code in the language of their choice. It was the main version of Selenium for some
time.

3. Selenium WebDriver is the most commonly used component of Selenium. WebDriver


allows users to write custom code in their language of choice and interact with the
browser of their choice, through browser-specific drivers. WebDriver works on the OS
level and uses a Protocol called JSONWireProtocol to communicate with browsers.

4. Selenium GRID allows users to run tests on different machines, with different browsers
and OS simultaneously, which gives the ability to run tests in parallel, as such saving a
lot of time and resources of testing on several machines.
Selenium capabilities

 Open Source – Unlike tools like QTP, Selenium is open source, which means that no cost
is required to set up and use Selenium. Selenium is free to download and use.
 Mimic User Actions – Almost all real-world user actions like button click, drag, and drop
selection, checkboxes, keypresses, taps, scrolling can automate using Selenium.
 Easy Implementation – Selenium is famous for being user friendly. Users can develop
custom extensions for their use since code is open source.
 Language Support – The most significant benefit of Selenium is the extensive support for
various languages. Selenium supports maximum programming languages like Java,
Python, JavaScript, C#, Ruby, Perl, Haskell, Go, among others.
 Browser Support – Selenium can work on all the browser vendors that are out there.
Selenium has support for Chrome, Firefox, Edge, Internet Explorer, Safari.
 OS Support – Selenium bindings are available for all the primary OS like Linux, macOS,
Windows.
 Framework Support – Selenium supports multiple frameworks like Maven, TestNG,
PYTest, NUnit, Mocha, Jasmine, etc. Selenium integrates well with CI tools like Jenkins,
Circle CI, GOCD, Travis CI, Gitlab, etc.
 Code Reusability – Scripts written for Selenium are cross-browser compatible. Same
code can be run for multiple browsers using respective browser binaries and on separate
machines in a Grid configuration,
 Community Support – Since there are a lot of QA’s working on this tool, it is effortless
to find resources, tutorials as well as support on communities like Github,
StackOverflow, etc.

WebDriver (aka Selenium 2.0)

The WebDriver expands and improves on Selenium Remote Control. WebDriver does what it
says. It drives web browsers at a lower level than Selenium IDE. It consists of a set of APIs that
allow the tester to control the browser from an OS level. This can lead to much greater
efficiencies in more complex automation setups. It supports headless browsers as well, which
can also really speed up your testing. WebDriver is more suitable for more advanced, complex,
scalable automation. WebDriver protocol is W3C compliant. It replaces the older JSON Wire
Protocol.

The Selenium WebDriver technology supports the test code in the following languages:
 Java
 C#
 Python
 Ruby
 JavaScript
 PHP

The Selenium framework supports 7 different object locators as the way to interact with web
application properties. This is very critical to the success of test automation creation.
 By CSS ID: find_element_by_id
 By CSSclass name: find_element_by_class_name
 By name attribute: find_element_by_name
 By DOM structure or xpath: find_element_by_xpath
 By link text: find_element_by_link_text
 By partial link text: find_element_by_partial_link_text
 By HTML tag name: find_element_by_tag_name
Locators in Selenium IDE

Locator is a command that tells Selenium IDE which GUI elements ( say Text Box, Buttons,
Check Boxes etc) its needs to operate on. Identification of correct GUI elements is a prerequisite
to creating an automation script.

1. Locating by ID:
This is the most common way of locating elements since ID's are supposed to be unique
for each element.
Target Format: id=id of the element

2. Locating by Name:
Locating elements by name are very similar to locating by ID, except that we use the
"name=" prefix instead.
Target Format: name=name of the element

3. Tag Name Locator:


This locator in Selenium WebDriver is used to identify elements with Tag names like
div tag, a tag etc. A common example of this usage could be locating all links on given
homepage and verifying whether they are functional or broken. The below is the sample
syntax:
driver.findElements(By.tagName(a));

4. Class Name Locator In Selenium:


Class Name locator helps in locating element defined through the class attribute.

5. Locating by XPath:
XPath is the language used when locating XML (Extensible Markup Language) nodes.
Since HTML can be thought of as an implementation of XML, we can also use XPath in
locating HTML elements. It can access almost any element, even those without class,
name, or id attributes.

6. A CSS Selector is a combination of an element selector and a value which identifies the
web element within a web page. They are string representations of HTML tags, attributes,
Id and Class
Syntax for Locator Usage

Method Target Syntax Example

By ID id= id_of_the_element id=email

By Name name=name_of_the_element name=userName

By Name name=name_of_the_element filter=value_of_filter name=tripType value=oneway


Using Filters

By Link link=link_text link=REGISTER


Text

Tag and ID css=tag#id css=input#email

Tag and css=tag.class css=input.inputtext


Class

Tag and css=tag[attribute=value] css=input[name=lastName]


Attribute

Tag, Class, css=tag.class[attribute=value] css=input.inputtext[tabindex=1]


and
Attribute

INTERACTIONS
For the user/web application interaction to happen, a web browser is required. The browser
presents the user with a frontend that is basically a combination of HTML (Hypertext Markup
Language: the one that defines the structure and some behavior of the page), CSS (Cascading
Style Sheets: the one that defines the look-and-feel of the page), and JavaScript (the one that
allows behavior and interaction beyond HTML capabilities).

1. Textboxes
2. Radio buttons
3. Checkboxes
4. Dowpdown
5. Keyboard actions
6. Mouse actions
7. Multi select
1. Text box: User can put values into a text box using the 'sendkeys' method. Similarly, can
also retrieve text from a text box using the getattribute("value") command.

2. Radio button is a type of button in the web application which offers the user a way to select
one option from a set of items. If user select an option then the circle is filled and other
circles are deselected. Radio Buttons too can be toggled on by using the click() method.

3. Check Box: Toggling a check box on/off is done using the click() method. Checkbox
operations are easy to perform in the testing web application. There are two important
methods click() and isSelected() provided by Selenium WebDriver in test script to interact
with checkbox elements.

4. Drop Down: Selenium has special class designed to interact with drop down lists called
Select. From there user can easily choose option by id, index or displayed value. Drop Down
& Multi-Select list is the set of HTML fields. In order to handle drop-down and multi-select
list with Selenium WebDriver, it is essential to use Select class, It is the Webdriver class
which is the part of the selenium package, provides the implementation of the HTML
SELECT tag.

5. Keyboard represents a KeyBoard event. KeyBoard actions are performed by using low-level
interface which allows us to provide virtualized device input to the web browser. sendKeys,
keyDown, keyUp, clear are the options.

6. Actions class methods for Mouse interactions are Click (), ContextClick(), DoubleClick(),
ClickAndHold(), MoveToElement(), Release(), MoveByOffset(), DragAndDrop(),
DragAndDropBy()

7. Building a Series of Multiple Actions. The series of actions an be built by using the Action
and Actions classes. Remember to close the series with the build() method.

You might also like