0% found this document useful (0 votes)
57 views20 pages

Selenium Tutorial

Selenium is an open-source tool used for automating web application testing. It supports testing across browsers and operating systems. Selenium IDE is a Firefox plugin that allows recording and playback of test cases in the browser. Selenium WebDriver sends commands directly to the browser without using a third-party to control programs. Selenium Grid allows running tests in parallel across different machines and browsers.

Uploaded by

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

Selenium Tutorial

Selenium is an open-source tool used for automating web application testing. It supports testing across browsers and operating systems. Selenium IDE is a Firefox plugin that allows recording and playback of test cases in the browser. Selenium WebDriver sends commands directly to the browser without using a third-party to control programs. Selenium Grid allows running tests in parallel across different machines and browsers.

Uploaded by

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

Selenium Tutorial

Selenium
• Selenium is an open-source tool that is used for test
automation. It is licensed under Apache License 2.0.
• Selenium is a suite of tools that helps in automating
only web applications.
• It has capabilities to operate across different
browsers and operating systems. It is not just a
single tool but a set of tools that helps testers to
automate web-based applications more efficiently.
Tools & Descriptions
Selenium IDE
• Selenium Integrated Development Environment (IDE) is
a Firefox plugin that lets testers to record their actions
as they follow the workflow that they need to test.
Selenium RC
• Selenium Remote Control (RC) was the testing
framework that allowed more than simple browser
actions and linear execution. It makes use of the full
power of programming languages such as Java, C#, PHP,
Python, Ruby and PERL to create more complex tests.
Selenium WebDriver
• Selenium WebDriver is the successor to Selenium
RC which sends commands directly to the
browser and retrieves results.
Selenium Grid
• Selenium Grid is a tool used to run parallel tests
across different machines and different browsers
simultaneously which results in minimized
execution time.
Advantages of Selenium

Selenium QTP
QTP is a commercial tool and there is a cost
Selenium is an open-source tool. involved in each one of the licenses.

Can be extended for various technologies that Limited add-ons and needs add-ons for each one
expose DOM. of the technologies.

Has capabilities to execute scripts across different Can run tests in specific versions of Firefox , IE,
browsers. and Chrome.
Can execute scripts on various operating systems. Works only with Windows.

Supports mobile devices with the help of third-


Supports mobile devices.
party tools.
Executes tests within the browser, so focus is NOT
required while script execution is in progress. Needs Focus during script execution, as the tool
acts on the browser (mimics user actions).

QTP cannot execute tests in parallel, however


Can execute tests in parallel with the use of integrating QTP with QC allows testers to execute
Selenium Grids. in parallel. QC is also a commercial tool.
Disadvantage of Selenium
Selenium QTP
Supports only web based applications.
Can test both web and desktop applications.

No feature such as Object Repository/Recovery QTP has built-in object repositories and
Scenario recovery scenarios.

No IDE, so the script development won't be as More intuitive IDE; automation can be
fast as QTP. achieved faster.

Can access controls within the browser such as


favorites bar, backward, and forward buttons.
Cannot access controls within the browser.

No default test report generation. Default test result generation within the tool.

For parameterization, users has to rely on the


programming language. Parameterization is built-in and easy to
implement.
• Step 1 − Launch Firefox and navigate to the
following URL - http://seleniumhq.org/download/
.
• Step 2 − Firefox add-ons notifier pops up with
allow and disallow options. User has to allow the
installation.
• Step 3 − The add-ons installer warns the user
about untrusted add-ons. Click 'Install Now'.
• Step 4 − The Selenium IDE can now be accessed
by navigating to Tools >>Selenium IDE.
• Step 5 − The Selenium IDE can also be
accessed directly from the quick access menu
bar as shown below.
Features of Selenium IDE
Control Control Name Description
Speed Control This helps in controlling the speed of
the test case runs.
Run All Executes the entire test suite that
contains multiple test cases.

Run Executes the currently selected test.

Pause/Resume Allows user to pause or resume the


script execution. Enabled only during
the execution.

Step Helps user to debug the test by


executing only one step of a test case
at a time.
Test Runner Mode Allows user to execute the test case in
a browser loaded with the selenium
Core. It is an obsolete functionality
that likely to be deprecated.

Apply Rollup Rules This features allows repetitive


sequences of selenium commands to
be grouped into a single action.

Record This features helps user to Records


the user's browser actions.
• The following steps are involved in creating
Selenium tests using IDE −
• Recording and adding commands in a test
• Saving the recorded test
• Saving the test suite
• Executing the recorded test
• Recording and Adding Commands in a Test
• We will use www.ncalculators.com to
demonstrate the features of Selenium.
• Step 1 − Launch the Firefox browser and
navigate to the website - 
https://www.ncalculators.com/
• Step 2 − Open Selenium IDE from the Tools
menu and press the record button that is on
the top-right corner.
• Step 3 − Navigate to "Math Calculator" >>
"Percent Calculator >> enter "10" as number1
and 50 as number2 and click "calculate".
• Step 4 − User can then insert a checkpoint by
right clicking on the webelement and select
"Show all available commands" >> select
"assert text css=b 5"
• Step 5 − The recorded script is generated and
the script is displayed as shown below.
• Saving the Recorded Test
• Step 1 − Save the Test Case by navigating to
"File" >> "Save Test" and save the file in the
location of your choice. The file is saved
as .HTML as default.
• Step 2 − The tests can be recorded one by one
by choosing the option "New Test Case" from
the "File" Menu.
• Step 3 − The individual tests are saved with a
name along with saving a "Test Suite".
Executing the Recorded Test
• The recorded scripts can then be executed either by
clicking "Play entire suite" or "Play current test"
button in the toolbar.
• Step 1 − The Run status can be seen in the status
pane that displays the number of tests passed and
failed.
• Step 2 − Once a step is executed, the user can see the
result in the "Log" Pane.
• Step 3 − After executing each step, the background of
the test step turns "Green" if passed and "Red" if
failed as shown below.

You might also like