Week 06 Test Automation - Lab
Week 06 Test Automation - Lab
HNDIT-4022
SELENIUM – TEST
AUTOMATION TOOL
CONTENT
• Selenium is.
• Features of selenium.
• Advantages of selenium.
• Components of selenium.
• References.
1.Selenium is
• Selenium IDE.
• Selenium RC.
• Selenium Web Driver.
• Selenium Grid.
4.Components of selenium (Cotd.)
1.Selenium IDE.
• IDE stand for Integrated Development Environment.
• It was a Firefox plugin for faster creation of test cases.
• Which is use for Record and Play back the script.
• Selenium IDE is a accountable for user action.
1.Selenium IDE(contd.) - Features
1.Selenium IDE(contd.) – Pros & Cons
Pros
• Very easy to use and
install. Cons
• No programming • Available only in Firefox.
experience is required, • Designed only to create
through knowledge of prototypes of tests.
HTML and DOM are • No support for iteration
needed. and confidential
• Can export tests to operations.
formats unable in • Test execution is slow
Selenium RC and compared to that of
WebDriver. selenium RC and
• Has built-in help and test WebDriver.
results reporting module.
• Provide supports for
extensions.
Selenium IDE(contd.) – Demo
URL
Steps to Record Selenium IDE Test Script (contd.)
Save
3. The file was saved as
HTML.
3.Steps to PlayBack
Selenium IDE Test
Script
Run all tests
1.Selenium IDE(contd.) - Selenium IDE Commands
(Selenese)
2.Accessor 3.Assertio
1.Actions
Generally manipulate s ns
the state of the These commands These commands
application. examine the state are like accessors,
of the application but they verify that
Eg:-type this
and store the result the state of the
box, click this
link or select option in variables. application
conforms to what
If an Action fails Eg:-storeTitle is expected.
current test is stopped.
Selenium
Many Actions can be They are also used Assertions can also
called with to automatically be categorized into
the AndWait suffix,
generate three categories.
e.g. clickAndWait, ty
peAndWait. Assertions. Eg;-Assert,
Verify, WaitFor
1.Selenium IDE(contd.) - Commonly used Selenium IDE
commands
Command Description
1.type Sets the value of an input field, as though you typed it in
2.open Opens a page using a URL.
3.click Clicks on a link, button, checkbox or radio button.
4.assertTitle, Verifies an expected page title
VerifyTitle
5. Verify / Asserts the presence of an element on a web page.
assertElementPres
ent,
verifyElementPrese
nt
6. Verify / Asserts the presence of a text within the web page.
assertTextPresent,
verifyTextPresent
7.type, typeKeys, Enters a value (String) in the specified web element.
Command Description
8. Click, clickAt, Clicks on a specified web element within a web page.
clickAndWait
9. Sleeps the execution and waits until the page is loaded
waitForPageToLoad completely.
10. waitForElement Sleeps the execution and waits until the specified element is
Present present
11.chooseOkOnNex Click on ”OK” or “Cancel” button when next confirmation box
t appears.
Confirmation,
chooseCancelOn
NextConfirmation
12. highlight Briefly changes the background Color of the specified
element yellow. Useful for debugging.
13. echo Prints the specified message into the third table cell in your
Selenese tables. Useful for debugging.
14.pause Wait for the specified amount of time (in milliseconds).
1.Selenium IDE(contd.) - Locators
2.Selenium RC
• Flagship Testing Framework of the whole Selenium project for a
long time.
• Allow users to use a programming language they prefer.
• RC version 2.25.0 support for C#,PHP,and Java.
• Make request using GET/POST method and capable of setting
HTTP requests.
• Automate web application.
2.Selenium RC(contd.) – Pros & Cons
Pros Cons
• Installation is not easy
• Cross browser and
when comparing with IDE.
platform.
• User need technical
• Can perform looping and
knowledge regarding
conditional operations.
• Support for data-driven programming language.
• Need Selenium RC server
testing.
• Has matured and complete to execute.
• API commands are more
API.
• Support for new browsers. confusing.
• Less realistic browser
• Faster execution when
interaction.
comparing with IDE.
2.Selenium RC(contd.) – Main components
RC Client
Server Library
Selenium Applicatio
Core n Under
Test
2.Selenium RC(contd.) – Overview of Selenium RC
2.Selenium RC(contd.) – Installation
• https://www.protechtraining.com/content/selenium_tutorial-se
lenium_remote_control
4.Components of selenium (Cotd.)
3.Selenium WebDriver
• Better than both Selenium IDE and Selenium RC.
• Does not rely on JavaScript for Automation.
• It controls the browser by directly communicating with it.
• Support language ;- Java, C#, PHP, Python, Perl, Ruby.
• It mainly supports browsers like Firefox, Chrome, Safari and Internet
Explorer.
• You can now use conditional operations like if-then-else or
switch-case. You can also perform looping like do-while.
3.Selenium WebDriver(contd.) – Pros & Cons
Cons
• But installation is
Pros complicated when
• Easy to install comparing comparing with selenium
with RC. IDE.
• Directly connect with • Need programming
browser. language.
• Support for data-driven • Not support readily for
testing. new browsers.
• Browser interaction is • API commands are more
more realistic. confusing.
• Execution time is fast than • There was no any built-in
RC and IDE. mechanism to generate
result.
3.Selenium WebDriver(contd.) – Architecture
3.Selenium WebDriver(contd.) – Architecture with RC
3.Selenium WebDriver(contd.) – Installation
• 4.Selenium Grid.
• Used together with Selenium RC to run parallel tests (running multiple
tests at once)
• Across different machines and different browsers all at the same time.
• Since Saves time enormously.
• Utilizes the hub-and-nodes concept(The hub acts as a central
source of Selenium commands to each node connected to it)
• To run a huge test suite, that needs to complete in the soonest time
possible.
4.Selenium Grid (cotd.) - hub-and-
nodes concept
Hub Node
1.Central point where you load 1.Selenium instances that will
your tests into execute the tests that you loaded
on the hub
2. Only be one hub 2.Can be one or more nodes
3. Launched only on a single 3. Can be launched on multiple
machine machines with different platforms
and browsers.
4. The machine containing the 4.The machines running the
hub is where the tests will be run nodes need not be the same
platform as that of the hub.
5.References
• https://www.guru99.com/introduction-selenuim-ide.html
• https://www.guru99.com/first-webdriver-script.html
• https://www.guru99.com/introduction-to-selenium-grid.html#:
~:text=Selenium%20Grid%20is%20a%20part,server%20acts
%20as%20a%20hub.
• https://www.edureka.co/blog/what-is-selenium/
• https://www.toolsqa.com/selenium-ide/locators-in-selenium-id
e/