SlideShare a Scribd company logo
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

What's hot (20)

PDF
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
PPTX
Python selenium
Ducat
 
PPTX
Selenium web driver
Roman Savitskiy
 
PDF
Selenium WebDriver with C#
srivinayak
 
PDF
Test Automation Using Python | Edureka
Edureka!
 
PPTX
Selenium- A Software Testing Tool
Zeba Tahseen
 
PPTX
Selenium
Batch2016
 
PPTX
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Edureka!
 
PPT
Groovy presentation
Manav Prasad
 
PPT
Test automation using selenium
shreyas JC
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PPTX
Mobile Automation with Appium
Manoj Kumar Kumar
 
PDF
Webdriver.io
LinkMe Srl
 
PPTX
Selenium ppt
Aneesh Rangarajan
 
PPTX
Selenium test automation
Srikanth Vuriti
 
PPTX
Selenium PPT 2.pptx
ssusere4c6aa
 
PPTX
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
PPTX
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Pankaj Dubey
 
PPTX
Selenium introduction
Pankaj Dubey
 
PPT
Selenium
Adam Goucher
 
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Python selenium
Ducat
 
Selenium web driver
Roman Savitskiy
 
Selenium WebDriver with C#
srivinayak
 
Test Automation Using Python | Edureka
Edureka!
 
Selenium- A Software Testing Tool
Zeba Tahseen
 
Selenium
Batch2016
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Edureka!
 
Groovy presentation
Manav Prasad
 
Test automation using selenium
shreyas JC
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Mobile Automation with Appium
Manoj Kumar Kumar
 
Webdriver.io
LinkMe Srl
 
Selenium ppt
Aneesh Rangarajan
 
Selenium test automation
Srikanth Vuriti
 
Selenium PPT 2.pptx
ssusere4c6aa
 
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Pankaj Dubey
 
Selenium introduction
Pankaj Dubey
 
Selenium
Adam Goucher
 

Viewers also liked (17)

PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
PDF
Automation Testing using Selenium
Naresh Chintalcheru
 
PPT
Selenium ppt
Pavan Kumar
 
PPTX
Selenium ile Web testi.
Mahmut Gündoğdu
 
PDF
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
PDF
Introduction to Selenium Webdriver - SpringPeople
SpringPeople
 
PPTX
Selenium topic 3 -Web Driver Basics
ITProfessional Academy
 
PPTX
Selenium Automation
Anuradha Malalasena
 
PPT
Junit and testNG
Марія Русин
 
PPTX
Design patterns in web testing automation with WebDriver
Mikalai Alimenkou
 
PDF
Selenium - The page object pattern
Michael Palotas
 
PDF
Perils of Page-Object Pattern
Anand Bagmar
 
PPTX
JUnit- A Unit Testing Framework
Onkar Deshpande
 
PPS
JUnit Presentation
priya_trivedi
 
PPTX
Basic Selenium Training
Dipesh Bhatewara
 
PDF
Using The Page Object Pattern
Dante Briones
 
PPT
Selenium Architecture
rohitnayak
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium ppt
Pavan Kumar
 
Selenium ile Web testi.
Mahmut Gündoğdu
 
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
Introduction to Selenium Webdriver - SpringPeople
SpringPeople
 
Selenium topic 3 -Web Driver Basics
ITProfessional Academy
 
Selenium Automation
Anuradha Malalasena
 
Junit and testNG
Марія Русин
 
Design patterns in web testing automation with WebDriver
Mikalai Alimenkou
 
Selenium - The page object pattern
Michael Palotas
 
Perils of Page-Object Pattern
Anand Bagmar
 
JUnit- A Unit Testing Framework
Onkar Deshpande
 
JUnit Presentation
priya_trivedi
 
Basic Selenium Training
Dipesh Bhatewara
 
Using The Page Object Pattern
Dante Briones
 
Selenium Architecture
rohitnayak
 
Ad

Similar to Selenium WebDriver (20)

PDF
Web driver selenium simplified
Vikas Singh
 
PDF
Selenium Introduction by Sandeep Sharda
Er. Sndp Srda
 
PPTX
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
PPTX
A Deep Dive into the W3C WebDriver Specification
Peter Thomas
 
PDF
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Alan Richardson
 
PPTX
Selenium.pptx
Pandiya Rajan
 
PPT
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
PDF
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
gumiflijo
 
PDF
Selenium course training institute ameerpet hyderabad – Best software trainin...
Sathya Technologies
 
PDF
Selenium course training institute ameerpet hyderabad
Sathya Technologies
 
PDF
Web UI test automation instruments
Artem Nagornyi
 
PPTX
Selenium web driver
Sun Technlogies
 
PPT
Selenium
Sun Technlogies
 
PPTX
Introduction to selenium web driver
Return on Intelligence
 
PPT
Selenium
husnara mohammad
 
PPTX
Selenium Training in Chennai Demo Part-2
Thecreating Experts
 
PPTX
Web testing with Selenium
XBOSoft
 
PPTX
Web driver training
Dipesh Bhatewara
 
PDF
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
PDF
Stanislaw potoczny kra_qa_21.01.20
kraqa
 
Web driver selenium simplified
Vikas Singh
 
Selenium Introduction by Sandeep Sharda
Er. Sndp Srda
 
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
A Deep Dive into the W3C WebDriver Specification
Peter Thomas
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Alan Richardson
 
Selenium.pptx
Pandiya Rajan
 
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
Handson Selenium Webdriver With Java A Deep Dive Into The Development Of Endt...
gumiflijo
 
Selenium course training institute ameerpet hyderabad – Best software trainin...
Sathya Technologies
 
Selenium course training institute ameerpet hyderabad
Sathya Technologies
 
Web UI test automation instruments
Artem Nagornyi
 
Selenium web driver
Sun Technlogies
 
Selenium
Sun Technlogies
 
Introduction to selenium web driver
Return on Intelligence
 
Selenium Training in Chennai Demo Part-2
Thecreating Experts
 
Web testing with Selenium
XBOSoft
 
Web driver training
Dipesh Bhatewara
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Stanislaw potoczny kra_qa_21.01.20
kraqa
 
Ad

Recently uploaded (20)

PPTX
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PPTX
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PPTX
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PPTX
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
PPTX
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PDF
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
google promotion services in Delhi, India
Digital Web Future
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 

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