SlideShare a Scribd company logo
2
Most read
5
Most read
7
Most read
SELENIUM 
WEBDRIVER 
Yuriy Bezgachnyuk, SSU/ITA 
October, 2014
Test automation 
What is Selenium WebDriver 
Selenium WD Features 
Document Object Model (DOM) 
 Locators 
Example task 
 PageObject pattern introduction 
2 
Agenda
Test Automation 
 In software testing, 
test automation is 
the use of special 
software (separate 
from the software 
being tested) to 
control the execution 
of tests and the 
comparison of actual 
outcomes to 
predicted outcomes. 
Test automation 3
What is Selenium Web Driver 
Selenium WebDriver – it’s a compact 
Object-Oriented API for Internet Browsers 
control 
WebDriver is the name of the key interface 
against which tests should be written in 
Java, Python, Ruby, … 
What is Selenium Web Driver 4
Selenium WD Features 
Connects to most modern browsers 
 Allows remote control 
 Finds elements by selectors 
 Modifies values of HTML elements 
 Interacts with DOM elements 
 Handles modal, popup windows 
Selenium WD Features 5
Document Object Model (DOM) 
The Document Object Model (DOM) is a 
cross-platform and language-independent 
convention for representing and interacting 
with objects in HTML, XHTML and XML 
documents. 
DOM Introduction 6
DOM [Locators] 
Select any HTML element(s) from DOM by 
using 
 tags name 
 attributes of tags 
• id, name, … 
 CSS selectors 
 XPath 
DOM [Locators] 7
Example Task 
A web-page with a HTML form is given 
[Fig. 1] 
User login functionality should be tested 
 Set value for ‘login’ field 
 Set value for ‘password’ field 
 Click submit button 
 Check results 
Task 8
Explanation of example 
URL for Login form 
http://<HOME_URL>/admin/login 
User inputs correct credentials and is 
redirected to URL: 
http://<HOME_URL>/admin 
otherwise user is redirected back to the 
login form page 
Explanation of practical example 9
Implementation [Template] 
JUnit 4 testing framework will be used 
Template 10 
Initial 
operations 
Finally 
operations 
Our main part of 
code will be here
setUp() method 
setUp() method provides pre-test 
WebDriver configuration. 
setUp() 11 
Object for 
concrete 
browser 
Set time for 
waiting 
Visit to page 
specified in 
URL constant
tearDown() method 
 tearDown() method provides post-test 
actions (WebDriver object disposal, used 
resources freeing). 
Close WebDriver 
and free 
resources 
tearDown() method 12
Task implementation 
Page Object pattern use. 
Selenium WebDriver use for low-level 
browser API functions only!!! 
Definitions of Page Object pattern: 
 Each single web-page is represented through a 
Java class 
 User actions for each web page are 
implemented as class methods 
PageObject pattern [Introduction] 13
PageObject Pattern 
PageObject Pattern 14
Task Implementation 
Let investigate our code for test user logon 
Object for HomePage 
where login form is 
Task’s solution 15 
placed 
Object for ResultPage 
URL from address bar 
of browser 
Comparison existing 
URL address with 
needed address
16 
Class HomePage 
Method for set 
values into HTML 
form and submit 
data to server
Code sample 
Code investigation 17
WebDriver Low level methods 
findElement(By arg) – searches and 
returns an object representation of DOM 
element. Input parameter arg – some of 
possible selectors (using static methods of 
By class) 
sendKeys(CharSequence arg) – sends 
char sequence to a HTML form element 
click() – clicks on a DOM element 
WD Low-level methods 18
Windows handling 
Web applications may have frames or 
multiple windows, that need to be 
specifically handled. WebDriver supports 
moving between named windows with 
switchTo() method: 
Windows switching should be used when 
application has JS modal windows (alerts) 
driver.switchTo().window("windowName"); 
Moving between windows and frames 19
Windows handling 
 When we clicking “Вхід” button without 
supplying credentials an alert modal 
window appears [Fig.1] 
 In order to click ‘OK’ 
button WebDriver 
should be switched to 
modal window 
Moving between windows and frames 20
Example #2 [Code] 
 Let’s take a look at the code 
Switch to JS alert 
window and click ‘OK’ 
button 
Example #2 [Code] 21
22 
“Main” class source
http://www.w3schools.com/ 
https://developer.mozilla.org/ 
http://docs.seleniumhq.org/ 
23 
References and Sources
QUESTIONS?

More Related Content

PPTX
Automation Testing by Selenium Web Driver
PPT
Selenium
PPTX
Introduction to Selenium Web Driver
PPTX
Test Automation and Selenium
PPT
Automated Web Testing Using Selenium
PPTX
Automation - web testing with selenium
PPTX
Test automation using selenium
PPTX
An overview of selenium webdriver
Automation Testing by Selenium Web Driver
Selenium
Introduction to Selenium Web Driver
Test Automation and Selenium
Automated Web Testing Using Selenium
Automation - web testing with selenium
Test automation using selenium
An overview of selenium webdriver

What's hot (20)

PDF
Webdriver io presentation
PPT
Test automation using selenium
PPTX
Data driven Automation Framework with Selenium
PPT
Selenium Concepts
PDF
Automation Testing using Selenium
PDF
Web application testing with Selenium
PPT
Selenium ppt
PPTX
Selenium WebDriver training
PPT
QSpiders - Automation using Selenium
PPTX
Selenium introduction
PPTX
Selenium
PPT
Selenium
PDF
Web automation using selenium.ppt
PDF
Automation Testing using Selenium Webdriver
PDF
What's new in selenium 4
ODP
Selenium ppt
PPTX
TestNG with selenium
PPT
Selenium Presentation at Engineering Colleges
PPTX
Selenium web driver
PPTX
Selenium-Locators
Webdriver io presentation
Test automation using selenium
Data driven Automation Framework with Selenium
Selenium Concepts
Automation Testing using Selenium
Web application testing with Selenium
Selenium ppt
Selenium WebDriver training
QSpiders - Automation using Selenium
Selenium introduction
Selenium
Selenium
Web automation using selenium.ppt
Automation Testing using Selenium Webdriver
What's new in selenium 4
Selenium ppt
TestNG with selenium
Selenium Presentation at Engineering Colleges
Selenium web driver
Selenium-Locators
Ad

Viewers also liked (15)

PPT
Selenium ppt
PPTX
Selenium ile Web testi.
PDF
Webinar: Selenium WebDriver - Automation Uncomplicated
PDF
Introduction to Selenium Webdriver - SpringPeople
PPTX
Selenium topic 3 -Web Driver Basics
PPTX
Selenium Automation
PPT
Junit and testNG
PPTX
Design patterns in web testing automation with WebDriver
PDF
Selenium - The page object pattern
PDF
Perils of Page-Object Pattern
PPTX
JUnit- A Unit Testing Framework
PPS
JUnit Presentation
PPTX
Basic Selenium Training
PDF
Using The Page Object Pattern
PPT
Selenium Architecture
Selenium ppt
Selenium ile Web testi.
Webinar: Selenium WebDriver - Automation Uncomplicated
Introduction to Selenium Webdriver - SpringPeople
Selenium topic 3 -Web Driver Basics
Selenium Automation
Junit and testNG
Design patterns in web testing automation with WebDriver
Selenium - The page object pattern
Perils of Page-Object Pattern
JUnit- A Unit Testing Framework
JUnit Presentation
Basic Selenium Training
Using The Page Object Pattern
Selenium Architecture
Ad

Similar to Selenium WebDriver (20)

PDF
Web driver selenium simplified
PDF
Selenium Introduction by Sandeep Sharda
PPTX
Web UI Tests: Introduce UI tests using Selenium
PPTX
A Deep Dive into the W3C WebDriver Specification
PDF
Selenium Clinic Eurostar 2012 WebDriver Tutorial
PPTX
Selenium.pptx
PPT
Automation with Selenium Presented by Quontra Solutions
PDF
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
PDF
Selenium course training institute ameerpet hyderabad
PDF
Selenium course training institute ameerpet hyderabad – Best software trainin...
PDF
Web UI test automation instruments
PPTX
Selenium web driver
PDF
Advanced Techniques to Build an Efficient Selenium Framework
PPT
Selenium
PPTX
Introduction to selenium web driver
PPT
PPTX
Selenium Training in Chennai Demo Part-2
PPTX
Web testing with Selenium
PPTX
Web driver training
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Web driver selenium simplified
Selenium Introduction by Sandeep Sharda
Web UI Tests: Introduce UI tests using Selenium
A Deep Dive into the W3C WebDriver Specification
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium.pptx
Automation with Selenium Presented by Quontra Solutions
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
Selenium course training institute ameerpet hyderabad
Selenium course training institute ameerpet hyderabad – Best software trainin...
Web UI test automation instruments
Selenium web driver
Advanced Techniques to Build an Efficient Selenium Framework
Selenium
Introduction to selenium web driver
Selenium Training in Chennai Demo Part-2
Web testing with Selenium
Web driver training
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples

Recently uploaded (20)

PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
artificial intelligence overview of it and more
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
Paper PDF World Game (s) Great Redesign.pdf
Job_Card_System_Styled_lorem_ipsum_.pptx
artificial intelligence overview of it and more
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
The New Creative Director: How AI Tools for Social Media Content Creation Are...
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
SAP Ariba Sourcing PPT for learning material
The Internet -By the Numbers, Sri Lanka Edition
Sims 4 Historia para lo sims 4 para jugar
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Unit-1 introduction to cyber security discuss about how to secure a system
Decoding a Decade: 10 Years of Applied CTI Discipline
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Triggering QUIC, presented by Geoff Huston at IETF 123
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Introuction about ICD -10 and ICD-11 PPT.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps

Selenium WebDriver

  • 1. SELENIUM WEBDRIVER Yuriy Bezgachnyuk, SSU/ITA October, 2014
  • 2. Test automation What is Selenium WebDriver Selenium WD Features Document Object Model (DOM)  Locators Example task  PageObject pattern introduction 2 Agenda
  • 3. Test Automation  In software testing, test automation is the use of special software (separate from the software being tested) to control the execution of tests and the comparison of actual outcomes to predicted outcomes. Test automation 3
  • 4. What is Selenium Web Driver Selenium WebDriver – it’s a compact Object-Oriented API for Internet Browsers control WebDriver is the name of the key interface against which tests should be written in Java, Python, Ruby, … What is Selenium Web Driver 4
  • 5. Selenium WD Features Connects to most modern browsers  Allows remote control  Finds elements by selectors  Modifies values of HTML elements  Interacts with DOM elements  Handles modal, popup windows Selenium WD Features 5
  • 6. Document Object Model (DOM) The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. DOM Introduction 6
  • 7. DOM [Locators] Select any HTML element(s) from DOM by using  tags name  attributes of tags • id, name, …  CSS selectors  XPath DOM [Locators] 7
  • 8. Example Task A web-page with a HTML form is given [Fig. 1] User login functionality should be tested  Set value for ‘login’ field  Set value for ‘password’ field  Click submit button  Check results Task 8
  • 9. Explanation of example URL for Login form http://<HOME_URL>/admin/login User inputs correct credentials and is redirected to URL: http://<HOME_URL>/admin otherwise user is redirected back to the login form page Explanation of practical example 9
  • 10. Implementation [Template] JUnit 4 testing framework will be used Template 10 Initial operations Finally operations Our main part of code will be here
  • 11. setUp() method setUp() method provides pre-test WebDriver configuration. setUp() 11 Object for concrete browser Set time for waiting Visit to page specified in URL constant
  • 12. tearDown() method  tearDown() method provides post-test actions (WebDriver object disposal, used resources freeing). Close WebDriver and free resources tearDown() method 12
  • 13. Task implementation Page Object pattern use. Selenium WebDriver use for low-level browser API functions only!!! Definitions of Page Object pattern:  Each single web-page is represented through a Java class  User actions for each web page are implemented as class methods PageObject pattern [Introduction] 13
  • 15. Task Implementation Let investigate our code for test user logon Object for HomePage where login form is Task’s solution 15 placed Object for ResultPage URL from address bar of browser Comparison existing URL address with needed address
  • 16. 16 Class HomePage Method for set values into HTML form and submit data to server
  • 17. Code sample Code investigation 17
  • 18. WebDriver Low level methods findElement(By arg) – searches and returns an object representation of DOM element. Input parameter arg – some of possible selectors (using static methods of By class) sendKeys(CharSequence arg) – sends char sequence to a HTML form element click() – clicks on a DOM element WD Low-level methods 18
  • 19. Windows handling Web applications may have frames or multiple windows, that need to be specifically handled. WebDriver supports moving between named windows with switchTo() method: Windows switching should be used when application has JS modal windows (alerts) driver.switchTo().window("windowName"); Moving between windows and frames 19
  • 20. Windows handling  When we clicking “Вхід” button without supplying credentials an alert modal window appears [Fig.1]  In order to click ‘OK’ button WebDriver should be switched to modal window Moving between windows and frames 20
  • 21. Example #2 [Code]  Let’s take a look at the code Switch to JS alert window and click ‘OK’ button Example #2 [Code] 21