SlideShare a Scribd company logo
Selenium
Automated Testing Tool
History
โ€ข Developed in 2004 by Jason Huggins as a JavaScript library
used to automate his manual testing routines
โ€ข Selenium Core is born whose functionality underlies the
Selenium RC (Remote Control) and Selenium IDE tools
โ€ข The Limitation of having a JavaScript based automation
engine and browser security restricted Selenium to specific
functionality
โ€ข Google, who has been a long time user of Selenium, had a
developer named Simon Stewart who developed WebDriver.
This tool circumvented Seleniumโ€™s JavaScript sandbox to
allow it to communicate with the Browser and Operating
System directly using native methods
โ€ข In 2008, Selenium and WebDriver merged technologies and
intellectual intelligence to provide the best possible test
automation framework
Introduction
โ€ข Selenium is a suite of testing automation tools
used for Web-Base applications: Selenium IDE,
Selenium RC, Selenium WebDriver and Selenium
Grid
โ€ข These tools provide a rich set of testing functions
specifically geared to varied testing scenarios of
all types of Web applications
โ€ข The operations provided by these tools are highly
flexible and afford many options for comparing UI
elements to expected application behavior
โ€ข Selenium tests can be executed on multiple
browser platforms
Why Use/Learn Selenium
๏ต Increases you marketability
๏ต Has a lot of Java planks
๏ต Growing Industry standard
๏ต Assist with the deployment of defective-free code
๏ต Open source, web-based testing automation tool and
cross-browser compliant
๏ต Muti-language backend support (Java, Ruby, Python, C#,
PHP, ectโ€ฆ)
Selenium Tools
โ€ข Selenium IDE
โ€ข Rapid prototyping tool for building test scripts
โ€ข Firefox plugin
โ€ข Can be used by developers with little to no programming experience to
write simple tests quickly and gain familiarity with the Selenese
commands
โ€ข Has a recording feature that records a userโ€™s live actions that can be
exported in one of many programming languages
โ€ข Does not provide iteration or conditional statements for test scripts
โ€ข Can only run tests against FireFox
โ€ข Developed tests can be run against other browsers, using a simple
command-line interface that invokes the Selenium RC server
โ€ข Can export WebDriver or Remote Control scripts (these scripts should be
in PageObject structure)
โ€ข Allows you the option to select a language for saving and displaying
test cases
Selenium Tools
โ€ข Selenium RC aka Selenium 1
โ€ข It โ€˜injectโ€™ JavaScript functions into the browser when the browser is loaded and then
uses its JavaScript to drive the AUT within the browser
โ€ข Mainly supported in maintenance mode
โ€ข Provides support for several programming languages
โ€ข Selenium WebDriver
โ€ข Designed to provide a simpler, more concise programming interface in addition to
addressing some limitations in the Selenium-RC API
โ€ข Developed to better support dynamic web pages where elements of a page may change
without the page itself being reloaded
โ€ข Makes direct calls to the browser using each browserโ€™s native support for automation.
โ€ข Has the Selenium 1 (aka Selenium RC) underlying technology for flexibility and
Portability
โ€ข Migrating From Selenium RC to Selenium WebDriver
โ€ข Not tied to any particular test framework, so it can be used equally well in unit testing
or from a plain old โ€œmainโ€ method.
Selenium Tools
โ€ข Selenium Grid
โ€ข Scales the Selenium RC solution for large test suites and test that must
be run in multiple environments
โ€ข Tests can be run in parallel with simultaneous execution (different
tests on different remote machines)
โ€ข It allows for running your tests in a distributed test execution
environment
โ€ข Used to run your tests against multiple browsers, multiple versions of
browser, and browsers running on different operating systems
โ€ข It reduces the time it takes for the test suite to complete a test pass
Selenium IDE
Selenium IDE
๏ต Selenese Commands
๏ต Action
๏ต Manipulate the state of the application
๏ต Used with โ€œAndWaitโ€ (clickAndWait)
๏ต Accessors
๏ต Examines the application state and stores the results in variables
๏ต Used to auto generate Assertions
๏ต Assertions
๏ต Similar to Accessors but verifies the state of the application to what is expected
๏ต Modes: assert, verify and waitFor
Selenium IDE
๏ต Syntax
๏ต Has two parameters (both are not required)
๏ต Can view command requirements from the command
reference tab
๏ต Parameters
๏ต Locators identify a UI Element on a page
๏ต Test Patterns are used for asserting or verifying
๏ต Selenium variable or Text Patterns that can be entered in
input fields or drop down selections
Selenium IDE
๏ต Selenese Command (continued)
๏ต AndWait
๏ต Tells Selenium to wait for the page to load after an action has been performed
๏ต Used when triggering navigation/page refresh (test will fail otherwise)
๏ต Command: clickAndWait
๏ต WaitFor
๏ต No set time period
๏ต Dynamically waits for the desired condition, checking every second
๏ต Commands: waitForElementPresent, waitForVisible, etcโ€ฆ
๏ต Echo
๏ต Used to display information progress notes that is displayed to the console during test
execution
๏ต Informational notes can be used to provide context within your test results report
๏ต Used to print the contents of Selenium variables
Selenium IDE
๏ต Store Commands and Selenium Variables
๏ต Selenium variables can be used to store constants at the
beginning of scripts and values passed to a test script from
the command-line, another program or file
๏ต Store Command
๏ต Two parameters (text value and Selenium variable)
๏ต Uses ${} to access the value of a variable
๏ต Can be used in the first or second parameter or within a
locator expression
๏ต Other Store Commands: storeElementPresent, storeText,
storeEval, ectโ€ฆ
Selenium IDE
๏ต JavaScript and Selenese Parameters
๏ต JavaScript uses script and non-script Selenese parameters
๏ต Parameters can be accessed via a JavaScript associative array
โ€œstoredVars[]โ€
๏ต Script Parameters
๏ต Specified by assertEval, verifyEval, storeEval and waitForEval
๏ต A snippet of JavaScript code is placed into the appropriate field,
normally the Target field (script parameters are usually the first or
only parameter)
๏ต Non-Script Parameters
๏ต Uses JavaScript to generate values for elements with non-script
parameters
๏ต JavaScript must be enclosed in curly braces and proceeded by the
label โ€œjavascriptโ€
Selenium IDE
๏ต Commonly Used Selenium Commands
๏ต open
๏ต click/clickAndWait
๏ต verifyTitle/assertTitle
๏ต verifyTextPresent
๏ต verifyElementPresent
๏ต verifyText
๏ต verifyTable
๏ต waitForPageToLoad
๏ต waitForElementPresent
Selenium IDE
๏ต Locators
๏ต By Identifier
๏ต Used by default
๏ต Locator type is โ€œidentifierโ€
๏ต First element with id attribute value matching the location will be used
๏ต First element with a name attribute matching the location will be used if there are no
id matches
๏ต By ID
๏ต More limited than the โ€œidentifierโ€ type
๏ต Locator type is โ€œidโ€
๏ต Use this type when you know the elementโ€™s id
๏ต By Name
๏ต Locates an element with a matching name attribute
๏ต Filters can be applied for elements with the same name attribute
๏ต Locator type is โ€œnameโ€
Selenium IDE
๏ต X-Path
๏ต Used for locating nodes in an XML document
๏ต Elements can be located in regards to absolute terms or a relative position to an
element that has a specified id or name attribute
๏ต Can locate elements via attributes other than id or name
๏ต Starts with โ€œ//โ€
๏ต By DOM
๏ต Can be accessed using Javascript
๏ต Locator type is โ€œdocumentโ€
๏ต By CSS
๏ต Uses the style binding of selectors to elements in a document as a locating strategy
๏ต Faster than X-Path and can find the most complicated objects in an intrinsic HTML
document
๏ต Locator type is โ€œcssโ€
Selenium IDE
๏ต Matching Patterns
๏ต Text Patterns
๏ต A parameter required by following Selenese commands: verifyText, verifyText,
verifyTitle, verifyAlert, assertConfirmation, verifyPrompt, ectโ€ฆ
๏ต Globbing Patterns
๏ต Pattern matching based on wild card characters (*, [], -)
๏ต Uses the โ€œglob:โ€ label
๏ต Default pattern matching scheme
๏ต Regular Expressions
๏ต The most powerful pattern matching scheme
๏ต Prefixed with โ€œregexp:โ€ label
๏ต Exact Patterns
๏ต Uses no special characters, no need to escape characters
๏ต Prefixed with โ€œexact:โ€ label
Selenium IDE
โ€ข Alerts, Pop-ups and Multiple Windows
โ€ข In Selenium, JavaScript alert and confirmation pop-ups will not
appear, they are overridden at runtime by Seleniumโ€™s own
JavaScript
โ€ข Alert pop-ups, however, still have a presence and would need
to be asserted with one of the various assertFoo functions
(assertFoo(pattern), assertFooPresent(), assertFooNotPresent(),
storeFoo(variable), storeFooPresent(variable), ectโ€ฆ
โ€ข Confirmation pop-ups select โ€œOkโ€ by default and use
assertConfirmation, assertConfirmationPresent, ect.. functions
Selenium IDE
โ€ข Debugging and Start Points
โ€ข Set a debug start point by right-clicking a command and toggle
โ€œbreak point/start pointโ€
โ€ข The Find button highlights the currently selected UI element on
the displayed page. From the Table view, select any command
that has a locator parameter and click the Find button
โ€ข To view portions of the Page Source, select the respective
portion of the web page, right-click, select view selection
source
โ€ข In recording a locator-type argument, Selenium IDE stores
additional information that presents the user with alternative
locator-type arguments
Selenium WebDriver
๏ต Page Objects
๏ต OO Library that separates test code into a MVC pattern
bringing OOP to test scripts
๏ต Language neutral pattern for representing a complete page or
position of a page in an OO manner
๏ต Requires Language specific coding
๏ต Used for maintenance, script cascading, enhanced script
readability/functionality
Selenium WebDriver
๏ต Scripts and Page Objects
๏ต Scripts are more procedural while Page Objects are detail
oriented
๏ต Locators appear once in all Page Objects of a page and do
not cross Page Object boundaries
๏ต Uses Elements, Actions and Synchronization
๏ต Order of Operation
๏ต Locator
๏ต Element Implementation
๏ต Add Elements to Page Objects
๏ต Actions
Selenium WebDriver
๏ต Do not create the Page Object all at once, build test
incrementally
๏ต Scripts Should
๏ต Not contain any synchronization code
๏ต Not contain any Driver API calls (promotes changes to
Selenium or other technology without changing the scripts)
๏ต Has asserts (determination of results)
Selenium WebDriver
๏ต Driver Implementations
๏ต HtmlUnitDriver
๏ต The fastest and most lightweight implementation of WebDriver
๏ต HtmlUnit is a java based implementation of a WebBrowser without a GUI
๏ต For any language binding (other than java) the Selenium Server is required to use this
driver
๏ต A pure Java solution and so it is platform independent
๏ต Supports JavaScript but emulates other browsersโ€™ JavaScript behaviour
๏ต FireFox Driver
๏ต Controls the Firefox browser using a Firefox plugin
๏ต Runs in a real browser and supports JavaScript
๏ต Faster than the Internet Explorer Driver but slower than HtmlUnitDriver
Selenium WebDriver
๏ต Internet Explorer Driver
๏ต This driver is controlled by a .dll files and is thus only
available on Windows OS
๏ต Each Selenium release has its core functionality tested against
versions 6, 7 and 8 on XP, and 9 on Windows7
๏ต Runs in a real browser and supports JavaScript
๏ต XPath is not natively supported in most versions
๏ต CSS is not natively supported in versions 6 and 7
๏ต CSS selectors in IE 8 and 9 are native, but those browsers
donโ€™t fully support CSS3
Selenium WebDriver
๏ต Driver Implementation
๏ต Chrome Driver
๏ต Chrome Driver is maintained / supported by the Chromium
Project
๏ต WebDriver works with Chrome through the chromedriver
binary (found on the chromium projectโ€™s download page)
๏ต Runs in a real browser and supports JavaScript
๏ต Because Chrome is a Webkit-based browser, the Chrome Driver
may allow you to verify that your site works in Safari. Note
that since Chrome uses its own V8 JavaScript engine rather
than Safariโ€™s Nitro engine, JavaScript execution may differ
๏ต Slower than the HtmlUnit Driver
Selenium RC
โ€ข In Selenium RC, the Selenium Server launches and kills
browsers, interprets and runs the Selenese commands
passed from the test program, and acts as an HTTP
proxy, intercepting and verifying HTTP messages passed
between the browser and the AUT
โ€ข Client libraries which provide the interface between
each programming language and the Selenium RC
Server.
โ€ข The primary task for using Selenium RC is to convert
your Selenese into a programming language
Selenium RC
Selenium RC
โ€ข Server, Security and Browers Configurations
โ€ข Command line options can be used to change the default server behaviour.
โ€ข If your AUT is behind an HTTP proxy which requires authentication then you should
configure http.proxyHost, http.proxyPort, http.proxyUser and http.proxyPassword
โ€ข You can run Selenese html files directly within the Selenium Server by passing the
html file to the serverโ€™s command line
โ€ข When launching selenium server the -log option can be used to record valuable
debugging information reported by the Selenium Server to a text file
โ€ข When dealing with HTTPS in a Selenium RC test, there is a run mode that supports
handling security pop-ups and processes the security certificate for you
โ€ข When a browser is not directly supported, you may still run your Selenium tests
against a browser of your choice by using the โ€œ*customโ€ run-mode (i.e. in place of
*firefox or *iexplore) when your test application starts the browser.
Selenium Grid
โ€ข A Grid consists of a single Hub, and one or more Nodes.
Both are started using a selenium-server.jar executable.
โ€ข The Hub receives a test to be executed along with
information on which browser and โ€˜platformโ€™ (i.e.
WINDOWS, LINUX, etc) where the test should be run.
โ€ข Since the Hub knows the configuration for each registered
Node, it selects an available Node that has the requested
browser-platform combination
โ€ข Selenium commands initiated by the test are sent to the
Hub, which passes them to the Node assigned to that test
โ€ข The Node runs the browser, and executes the Selenium
commands within that browser against the application
under test

More Related Content

What's hot (20)

PDF
Selenium WebDriver with C#
srivinayak
ย 
PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
ย 
PPTX
Test Automation and Selenium
Karapet Sarkisyan
ย 
PPTX
Selenium- A Software Testing Tool
Zeba Tahseen
ย 
PDF
SELENIUM PPT.pdf
RebelSnowball
ย 
PDF
Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...
Edureka!
ย 
PPT
Selenium Automation Framework
Mindfire Solutions
ย 
PPT
Selenium Concepts
Swati Bansal
ย 
PDF
Web automation using selenium.ppt
Ana Sarbescu
ย 
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
ย 
PPT
Automated Web Testing Using Selenium
Weifeng Zhang
ย 
PPTX
An overview of selenium webdriver
Anuraj S.L
ย 
PPT
Selenium Primer
gueste1e4db
ย 
PPS
Selenium Demo
ankitslide
ย 
PDF
Automation Testing using Selenium
Naresh Chintalcheru
ย 
PDF
Latest Selenium Interview Questions And Answers.pdf
Varsha Rajput
ย 
ODP
Selenium ppt
Anirudh Raja
ย 
PPTX
Selenium Automation in Java Using HttpWatch Plug-in
Sandeep Tol
ย 
PPTX
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
ย 
PPT
Selenium ppt
Naga Dinesh
ย 
Selenium WebDriver with C#
srivinayak
ย 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
ย 
Test Automation and Selenium
Karapet Sarkisyan
ย 
Selenium- A Software Testing Tool
Zeba Tahseen
ย 
SELENIUM PPT.pdf
RebelSnowball
ย 
Introduction to Selenium | Selenium Tutorial for Beginners | Selenium Trainin...
Edureka!
ย 
Selenium Automation Framework
Mindfire Solutions
ย 
Selenium Concepts
Swati Bansal
ย 
Web automation using selenium.ppt
Ana Sarbescu
ย 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
ย 
Automated Web Testing Using Selenium
Weifeng Zhang
ย 
An overview of selenium webdriver
Anuraj S.L
ย 
Selenium Primer
gueste1e4db
ย 
Selenium Demo
ankitslide
ย 
Automation Testing using Selenium
Naresh Chintalcheru
ย 
Latest Selenium Interview Questions And Answers.pdf
Varsha Rajput
ย 
Selenium ppt
Anirudh Raja
ย 
Selenium Automation in Java Using HttpWatch Plug-in
Sandeep Tol
ย 
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
ย 
Selenium ppt
Naga Dinesh
ย 

Similar to Selenium (20)

PPTX
Selenium
mdfkhan625
ย 
PPTX
Automation Testing
AbdulImrankhan7
ย 
PPTX
Selenium using Java
F K
ย 
PPT
Selenium (1) (1)
Vishwan Aranha
ย 
PPTX
Selenium
Batch2016
ย 
PPTX
Selenium
Rakshitha Raviprakash
ย 
PPTX
Selenium
Ivan Aranha
ย 
PPTX
Selenium
Batch2016
ย 
PPTX
Selenium-corporate-training-in-mumbai
Unmesh Baile
ย 
PPTX
Selenium.pptx
orbitprojects
ย 
PPTX
Selenium corporate-training-in-mumbai
vibrantuser
ย 
PDF
Selenium corporate-training-in-mumbai
vibrantuser
ย 
PPTX
Selenium
Satyam Pandey
ย 
DOC
Sel
Sandeep A R
ย 
PPT
Selenium
Daksh Sharma
ย 
PPTX
Selenium
Jahan Murugassan
ย 
PPTX
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Simplilearn
ย 
PPTX
Selenium web driver
Roman Savitskiy
ย 
PPT
Selenium
BugRaptors
ย 
PPTX
Learn Test Automation using Selenium - Lesson 1
Furqan Ud Din
ย 
Selenium
mdfkhan625
ย 
Automation Testing
AbdulImrankhan7
ย 
Selenium using Java
F K
ย 
Selenium (1) (1)
Vishwan Aranha
ย 
Selenium
Batch2016
ย 
Selenium
Ivan Aranha
ย 
Selenium
Batch2016
ย 
Selenium-corporate-training-in-mumbai
Unmesh Baile
ย 
Selenium.pptx
orbitprojects
ย 
Selenium corporate-training-in-mumbai
vibrantuser
ย 
Selenium corporate-training-in-mumbai
vibrantuser
ย 
Selenium
Satyam Pandey
ย 
Sel
Sandeep A R
ย 
Selenium
Daksh Sharma
ย 
Selenium
Jahan Murugassan
ย 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Simplilearn
ย 
Selenium web driver
Roman Savitskiy
ย 
Selenium
BugRaptors
ย 
Learn Test Automation using Selenium - Lesson 1
Furqan Ud Din
ย 
Ad

Recently uploaded (20)

PDF
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
PPTX
How Can Recruitment Management Software Improve Hiring Efficiency?
HireME
ย 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
ย 
PPTX
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
ย 
PPTX
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
PDF
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
ย 
PDF
Writing Maintainable Playwright Tests with Ease
Shubham Joshi
ย 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
PDF
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
ย 
PPTX
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
PDF
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
PPTX
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
ย 
PDF
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
PDF
The Rise of Sustainable Mobile App Solutions by New York Development Firms
ostechnologies16
ย 
PPTX
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
How Can Recruitment Management Software Improve Hiring Efficiency?
HireME
ย 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
ย 
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
ย 
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
ย 
Writing Maintainable Playwright Tests with Ease
Shubham Joshi
ย 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
ย 
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
ย 
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
The Rise of Sustainable Mobile App Solutions by New York Development Firms
ostechnologies16
ย 
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
Ad

Selenium

  • 2. History โ€ข Developed in 2004 by Jason Huggins as a JavaScript library used to automate his manual testing routines โ€ข Selenium Core is born whose functionality underlies the Selenium RC (Remote Control) and Selenium IDE tools โ€ข The Limitation of having a JavaScript based automation engine and browser security restricted Selenium to specific functionality โ€ข Google, who has been a long time user of Selenium, had a developer named Simon Stewart who developed WebDriver. This tool circumvented Seleniumโ€™s JavaScript sandbox to allow it to communicate with the Browser and Operating System directly using native methods โ€ข In 2008, Selenium and WebDriver merged technologies and intellectual intelligence to provide the best possible test automation framework
  • 3. Introduction โ€ข Selenium is a suite of testing automation tools used for Web-Base applications: Selenium IDE, Selenium RC, Selenium WebDriver and Selenium Grid โ€ข These tools provide a rich set of testing functions specifically geared to varied testing scenarios of all types of Web applications โ€ข The operations provided by these tools are highly flexible and afford many options for comparing UI elements to expected application behavior โ€ข Selenium tests can be executed on multiple browser platforms
  • 4. Why Use/Learn Selenium ๏ต Increases you marketability ๏ต Has a lot of Java planks ๏ต Growing Industry standard ๏ต Assist with the deployment of defective-free code ๏ต Open source, web-based testing automation tool and cross-browser compliant ๏ต Muti-language backend support (Java, Ruby, Python, C#, PHP, ectโ€ฆ)
  • 5. Selenium Tools โ€ข Selenium IDE โ€ข Rapid prototyping tool for building test scripts โ€ข Firefox plugin โ€ข Can be used by developers with little to no programming experience to write simple tests quickly and gain familiarity with the Selenese commands โ€ข Has a recording feature that records a userโ€™s live actions that can be exported in one of many programming languages โ€ข Does not provide iteration or conditional statements for test scripts โ€ข Can only run tests against FireFox โ€ข Developed tests can be run against other browsers, using a simple command-line interface that invokes the Selenium RC server โ€ข Can export WebDriver or Remote Control scripts (these scripts should be in PageObject structure) โ€ข Allows you the option to select a language for saving and displaying test cases
  • 6. Selenium Tools โ€ข Selenium RC aka Selenium 1 โ€ข It โ€˜injectโ€™ JavaScript functions into the browser when the browser is loaded and then uses its JavaScript to drive the AUT within the browser โ€ข Mainly supported in maintenance mode โ€ข Provides support for several programming languages โ€ข Selenium WebDriver โ€ข Designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API โ€ข Developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded โ€ข Makes direct calls to the browser using each browserโ€™s native support for automation. โ€ข Has the Selenium 1 (aka Selenium RC) underlying technology for flexibility and Portability โ€ข Migrating From Selenium RC to Selenium WebDriver โ€ข Not tied to any particular test framework, so it can be used equally well in unit testing or from a plain old โ€œmainโ€ method.
  • 7. Selenium Tools โ€ข Selenium Grid โ€ข Scales the Selenium RC solution for large test suites and test that must be run in multiple environments โ€ข Tests can be run in parallel with simultaneous execution (different tests on different remote machines) โ€ข It allows for running your tests in a distributed test execution environment โ€ข Used to run your tests against multiple browsers, multiple versions of browser, and browsers running on different operating systems โ€ข It reduces the time it takes for the test suite to complete a test pass
  • 9. Selenium IDE ๏ต Selenese Commands ๏ต Action ๏ต Manipulate the state of the application ๏ต Used with โ€œAndWaitโ€ (clickAndWait) ๏ต Accessors ๏ต Examines the application state and stores the results in variables ๏ต Used to auto generate Assertions ๏ต Assertions ๏ต Similar to Accessors but verifies the state of the application to what is expected ๏ต Modes: assert, verify and waitFor
  • 10. Selenium IDE ๏ต Syntax ๏ต Has two parameters (both are not required) ๏ต Can view command requirements from the command reference tab ๏ต Parameters ๏ต Locators identify a UI Element on a page ๏ต Test Patterns are used for asserting or verifying ๏ต Selenium variable or Text Patterns that can be entered in input fields or drop down selections
  • 11. Selenium IDE ๏ต Selenese Command (continued) ๏ต AndWait ๏ต Tells Selenium to wait for the page to load after an action has been performed ๏ต Used when triggering navigation/page refresh (test will fail otherwise) ๏ต Command: clickAndWait ๏ต WaitFor ๏ต No set time period ๏ต Dynamically waits for the desired condition, checking every second ๏ต Commands: waitForElementPresent, waitForVisible, etcโ€ฆ ๏ต Echo ๏ต Used to display information progress notes that is displayed to the console during test execution ๏ต Informational notes can be used to provide context within your test results report ๏ต Used to print the contents of Selenium variables
  • 12. Selenium IDE ๏ต Store Commands and Selenium Variables ๏ต Selenium variables can be used to store constants at the beginning of scripts and values passed to a test script from the command-line, another program or file ๏ต Store Command ๏ต Two parameters (text value and Selenium variable) ๏ต Uses ${} to access the value of a variable ๏ต Can be used in the first or second parameter or within a locator expression ๏ต Other Store Commands: storeElementPresent, storeText, storeEval, ectโ€ฆ
  • 13. Selenium IDE ๏ต JavaScript and Selenese Parameters ๏ต JavaScript uses script and non-script Selenese parameters ๏ต Parameters can be accessed via a JavaScript associative array โ€œstoredVars[]โ€ ๏ต Script Parameters ๏ต Specified by assertEval, verifyEval, storeEval and waitForEval ๏ต A snippet of JavaScript code is placed into the appropriate field, normally the Target field (script parameters are usually the first or only parameter) ๏ต Non-Script Parameters ๏ต Uses JavaScript to generate values for elements with non-script parameters ๏ต JavaScript must be enclosed in curly braces and proceeded by the label โ€œjavascriptโ€
  • 14. Selenium IDE ๏ต Commonly Used Selenium Commands ๏ต open ๏ต click/clickAndWait ๏ต verifyTitle/assertTitle ๏ต verifyTextPresent ๏ต verifyElementPresent ๏ต verifyText ๏ต verifyTable ๏ต waitForPageToLoad ๏ต waitForElementPresent
  • 15. Selenium IDE ๏ต Locators ๏ต By Identifier ๏ต Used by default ๏ต Locator type is โ€œidentifierโ€ ๏ต First element with id attribute value matching the location will be used ๏ต First element with a name attribute matching the location will be used if there are no id matches ๏ต By ID ๏ต More limited than the โ€œidentifierโ€ type ๏ต Locator type is โ€œidโ€ ๏ต Use this type when you know the elementโ€™s id ๏ต By Name ๏ต Locates an element with a matching name attribute ๏ต Filters can be applied for elements with the same name attribute ๏ต Locator type is โ€œnameโ€
  • 16. Selenium IDE ๏ต X-Path ๏ต Used for locating nodes in an XML document ๏ต Elements can be located in regards to absolute terms or a relative position to an element that has a specified id or name attribute ๏ต Can locate elements via attributes other than id or name ๏ต Starts with โ€œ//โ€ ๏ต By DOM ๏ต Can be accessed using Javascript ๏ต Locator type is โ€œdocumentโ€ ๏ต By CSS ๏ต Uses the style binding of selectors to elements in a document as a locating strategy ๏ต Faster than X-Path and can find the most complicated objects in an intrinsic HTML document ๏ต Locator type is โ€œcssโ€
  • 17. Selenium IDE ๏ต Matching Patterns ๏ต Text Patterns ๏ต A parameter required by following Selenese commands: verifyText, verifyText, verifyTitle, verifyAlert, assertConfirmation, verifyPrompt, ectโ€ฆ ๏ต Globbing Patterns ๏ต Pattern matching based on wild card characters (*, [], -) ๏ต Uses the โ€œglob:โ€ label ๏ต Default pattern matching scheme ๏ต Regular Expressions ๏ต The most powerful pattern matching scheme ๏ต Prefixed with โ€œregexp:โ€ label ๏ต Exact Patterns ๏ต Uses no special characters, no need to escape characters ๏ต Prefixed with โ€œexact:โ€ label
  • 18. Selenium IDE โ€ข Alerts, Pop-ups and Multiple Windows โ€ข In Selenium, JavaScript alert and confirmation pop-ups will not appear, they are overridden at runtime by Seleniumโ€™s own JavaScript โ€ข Alert pop-ups, however, still have a presence and would need to be asserted with one of the various assertFoo functions (assertFoo(pattern), assertFooPresent(), assertFooNotPresent(), storeFoo(variable), storeFooPresent(variable), ectโ€ฆ โ€ข Confirmation pop-ups select โ€œOkโ€ by default and use assertConfirmation, assertConfirmationPresent, ect.. functions
  • 19. Selenium IDE โ€ข Debugging and Start Points โ€ข Set a debug start point by right-clicking a command and toggle โ€œbreak point/start pointโ€ โ€ข The Find button highlights the currently selected UI element on the displayed page. From the Table view, select any command that has a locator parameter and click the Find button โ€ข To view portions of the Page Source, select the respective portion of the web page, right-click, select view selection source โ€ข In recording a locator-type argument, Selenium IDE stores additional information that presents the user with alternative locator-type arguments
  • 20. Selenium WebDriver ๏ต Page Objects ๏ต OO Library that separates test code into a MVC pattern bringing OOP to test scripts ๏ต Language neutral pattern for representing a complete page or position of a page in an OO manner ๏ต Requires Language specific coding ๏ต Used for maintenance, script cascading, enhanced script readability/functionality
  • 21. Selenium WebDriver ๏ต Scripts and Page Objects ๏ต Scripts are more procedural while Page Objects are detail oriented ๏ต Locators appear once in all Page Objects of a page and do not cross Page Object boundaries ๏ต Uses Elements, Actions and Synchronization ๏ต Order of Operation ๏ต Locator ๏ต Element Implementation ๏ต Add Elements to Page Objects ๏ต Actions
  • 22. Selenium WebDriver ๏ต Do not create the Page Object all at once, build test incrementally ๏ต Scripts Should ๏ต Not contain any synchronization code ๏ต Not contain any Driver API calls (promotes changes to Selenium or other technology without changing the scripts) ๏ต Has asserts (determination of results)
  • 23. Selenium WebDriver ๏ต Driver Implementations ๏ต HtmlUnitDriver ๏ต The fastest and most lightweight implementation of WebDriver ๏ต HtmlUnit is a java based implementation of a WebBrowser without a GUI ๏ต For any language binding (other than java) the Selenium Server is required to use this driver ๏ต A pure Java solution and so it is platform independent ๏ต Supports JavaScript but emulates other browsersโ€™ JavaScript behaviour ๏ต FireFox Driver ๏ต Controls the Firefox browser using a Firefox plugin ๏ต Runs in a real browser and supports JavaScript ๏ต Faster than the Internet Explorer Driver but slower than HtmlUnitDriver
  • 24. Selenium WebDriver ๏ต Internet Explorer Driver ๏ต This driver is controlled by a .dll files and is thus only available on Windows OS ๏ต Each Selenium release has its core functionality tested against versions 6, 7 and 8 on XP, and 9 on Windows7 ๏ต Runs in a real browser and supports JavaScript ๏ต XPath is not natively supported in most versions ๏ต CSS is not natively supported in versions 6 and 7 ๏ต CSS selectors in IE 8 and 9 are native, but those browsers donโ€™t fully support CSS3
  • 25. Selenium WebDriver ๏ต Driver Implementation ๏ต Chrome Driver ๏ต Chrome Driver is maintained / supported by the Chromium Project ๏ต WebDriver works with Chrome through the chromedriver binary (found on the chromium projectโ€™s download page) ๏ต Runs in a real browser and supports JavaScript ๏ต Because Chrome is a Webkit-based browser, the Chrome Driver may allow you to verify that your site works in Safari. Note that since Chrome uses its own V8 JavaScript engine rather than Safariโ€™s Nitro engine, JavaScript execution may differ ๏ต Slower than the HtmlUnit Driver
  • 26. Selenium RC โ€ข In Selenium RC, the Selenium Server launches and kills browsers, interprets and runs the Selenese commands passed from the test program, and acts as an HTTP proxy, intercepting and verifying HTTP messages passed between the browser and the AUT โ€ข Client libraries which provide the interface between each programming language and the Selenium RC Server. โ€ข The primary task for using Selenium RC is to convert your Selenese into a programming language
  • 28. Selenium RC โ€ข Server, Security and Browers Configurations โ€ข Command line options can be used to change the default server behaviour. โ€ข If your AUT is behind an HTTP proxy which requires authentication then you should configure http.proxyHost, http.proxyPort, http.proxyUser and http.proxyPassword โ€ข You can run Selenese html files directly within the Selenium Server by passing the html file to the serverโ€™s command line โ€ข When launching selenium server the -log option can be used to record valuable debugging information reported by the Selenium Server to a text file โ€ข When dealing with HTTPS in a Selenium RC test, there is a run mode that supports handling security pop-ups and processes the security certificate for you โ€ข When a browser is not directly supported, you may still run your Selenium tests against a browser of your choice by using the โ€œ*customโ€ run-mode (i.e. in place of *firefox or *iexplore) when your test application starts the browser.
  • 29. Selenium Grid โ€ข A Grid consists of a single Hub, and one or more Nodes. Both are started using a selenium-server.jar executable. โ€ข The Hub receives a test to be executed along with information on which browser and โ€˜platformโ€™ (i.e. WINDOWS, LINUX, etc) where the test should be run. โ€ข Since the Hub knows the configuration for each registered Node, it selects an available Node that has the requested browser-platform combination โ€ข Selenium commands initiated by the test are sent to the Hub, which passes them to the Node assigned to that test โ€ข The Node runs the browser, and executes the Selenium commands within that browser against the application under test