SlideShare a Scribd company logo
1 of 53
Download to read offline
Better Page Object Handling with
Loadable Component Pattern
Sargis Sargsyan
SQA Days, Belarus, 2016
‹ ›2
Loadable
Component
4
Introduction
1
Page Object
Pattern
2
Wait in
Selenium
3
Q & A
8
Common
Failures
7
Implementation
on existing
project
6
Main Topics
Slow Loadable
Component
5
‹ ›3
Demos
• Demos are in Java!
• Everything we discuss is applicable strongly-
typed languages (e.g. C#)
• Most things are applicable to dynamically-
typed languages (e.g. Ruby, Python, Perl)
‹ ›4
Demos will use also
• Maven
• TestNG
• Selenium
Page Object
Pattern
`
‹ ›6
What is Page Object Pattern
• Page Objects Framework is a design pattern which has become
popular in test automation for making easy test maintenance and
reducing code duplication. This design pattern, to interact or work
with a web page, we have an object-oriented class for that web. Then
the tests calls the methods of this page class by creating a page
object whenever they need to interact or work with that web page.
7
q 1Z
a
‹ ›7
What is Page Object Pattern
• For example web application or website that has multiple web pages
and each page offers different services and functionalities.
• There are different pages like
• Home page,
• Login page,
• Registration page.
• Each page offers a specific set of services. Services offered by
Login page Login by entering user name and password We can
get page title A class to represent Login page is like
‹ ›8
What is Page Object Pattern
• In page objects framework:
• Each page in the web application/website we consider as an
object.
• Each webpage in the web application is represented by a Class
• Each service/functionality offered by a webpage is represented
by a method in the respective page class
We will be having our tests calling these methods by creating objects
of page classes
‹ ›9
Why we should use Page Objects Pattern
1 Promotes reuse and refuses duplication
2 Makes tests more readable and robust
3 Makes tests less brittle
4 Improves maintainability, Particularly when there is frequent changes
5 If UI change, tests don’t need to be change, only the code within the page object need to be changed.
6 Handle of each page using its instance
‹ ›10
How does it structured?
• Each page is defined as it’s own class.
• Actions (including navigation) are represented as functions for a class.
• Each function can return a new Page object (navigating between
pages),
• Tests only talk to the page objects.
• Page objects only talk to the Base Object.
• Base Object talks to only driver.
• Elements on the page are stored as variables for the page object
‹ ›11
Selenium Model
Test Case 1
Test Case 2
Test Case …
ReportSelenium
Web app
Web PageWeb PageWeb PageWeb PageBrowsers
‹ ›12
Page Object Model
Page Objects
Test Case 1
Test Case 2
Test Case …
Report
Selenium
Web app
Web PageWeb PageWeb PageWeb PageBrowsers
‹ ›13
Page Object Model & Base Page
Page Objects
Test Case 1
Test Case 2
Test Case …
Report
Base Page
Selenium
Web app
Web PageWeb PageWeb PageWeb PageBrowsers
‹ ›14
Architecture
Framework/
PageObjectsL
Browser/Web
Application
Ħ
Selenium Tests X
Selenium
Web Driver
Ä
‹ ›15
How it looks like
‹ ›16
Base Object Page
‹ ›17
Base Object Page
‹ ›18
Selenium Setup
‹ ›19
Base Test
‹ ›20
Test
Wait in
Selenium
p
‹ ›22
Why to wait?
• When automating an application you must wait for a transaction to
complete before proceeding to your next action.
• Sleeps should never be a version for an alternative to waits. Sleeps
will ALWAYS wait the exact amount of time even if the application is
ready to continue the test.
‹ ›23
Wait as long as necessary
• We should wait as long as necessary which saves you precious time
on your execution.
• Selenium Offers 3 wait types:
• Implicit Waits
• Explicit Waits
• Fluent Waits
[
‹ ›24
Implicit Waits
• Implicit waits apply globally to every find element call.
• undocumented and practically undefined behavior
• Runs in the remote part of selenium (the part controlling the browser).
• Only works on find element(s) methods.
• Returns either element found or (after timeout) not found.
• If checking for absence of element must always wait until timeout.
• Cannot be customized other than global timeout.
• Best practice is to not use implicit waits if possible.
‹ ›25
Explicit Waits
• Documented and defined behavior
• Explicit waits ping the application every 500ms checking for the
condition of the wait to be true
• Runs in the local part of selenium (in the language of your code)
• Works on any condition you can think of
• Returns either success or timeout error
• Can define absence of element as success condition
• Can customize delay between retries and exceptions to ignore
‹ ›26
Explicit Waits
‹ ›27
Fluent Waits
• Fluent waits require that you define the wait between checks of the
application for an object/condition as well as the overall timeout of
the transaction. Additionally you must tell fluent waits not to throw an
exception when they don’t find an object as best practice.
Loadable
Component
p
‹ ›29
What is the LoadableComponent?
• The LoadableComponent is a base class that aims to make writing
PageObjects less painful. It does this by providing a standard way of
ensuring that pages are loaded and providing hooks to make
debugging the failure of a page to load easier. You can use it to help
reduce the amount of boilerplate code in your tests, which in turn
make maintaining your tests less tiresome.
• There is currently an implementation in Java that ships as part of
Selenium 2, but the approach used is simple enough to be
implemented in any language. *Selenium Wiki
‹ ›30
What is it?
• LoadableComponent is a base class in Selenium, which means that
you can simply define your Page Objects as an extension of the
LoadableComponent class. So, for example, we can simply define a
LoginPage object as follows:
‹ ›31
How to use
• The Loadable Component Pattern also allows you to model your
page objects as a tree of nested components.
• Allows better way to manage navigations between pages
• Uses the “load” method that is used to navigate to the page and the
“isLoaded” method which is used to determine if we are on the right
page.
‹ ›32
LoadableComponent class
‹ ›33
load() and inLoaded() methods
‹ ›34
PageLoadHelper Class
‹ ›35
isLoaded() with PageLoadHelper
‹ ›36
Extend LoadableComponent in Base Object class
‹ ›37
Custom Loadable Component Implementation
Slow
Loadable
Component
`
‹ ›39
What is the SlowLoadableComponent?
• The SlowLoadableComponent is a sub class of LoadableComponent.
• get() for SlowLoadableComponent will ensure that the component is
currently.
• isError() method will check for well known error cases, which would
mean that loading has finished, but an error condition was seen.
• waitFor() method will wait to run the next time.
After a call to load(), the isLoaded() method will continue to fail until the
component has fully loaded.
‹ ›40
SlowLoadableComponent class
‹ ›41
SlowLoadableComponent Implementation
Implementation
on existing
project
p
‹ ›43
Changes in Base Page
‹ ›44
Changes in Page Object
Common
Failures
l
‹ ›46
Recorded Brittle Test
‹ ›47
Recorded Brittle Test
‹ ›48
Not Building a Framework
‹ ›49
Use unique selectors
‹ ›50
Do not use Retry
y
‹ ›51
Do not try to Automate Hard Things
‹ ›52
Run test in Continuous Integration
1 Have a plan and stick to it
2 Run test as part of build
3 Run test locally
4 Report results
5 Break builds
✉ !
EMAIL TWITTER LINKEDIN
mrsargsyan sargissargsyan
Contacts
ą
Thank You!
sargis.sargsyan@live.com

More Related Content

What's hot

Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, SuccessfullySauce Labs
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJSKrishna Kumar
 
Introduction to jest
Introduction to jestIntroduction to jest
Introduction to jestpksjce
 
Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018Holger Grosse-Plankermann
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
Automated Testing With Jasmine, PhantomJS and Jenkins
Automated Testing With Jasmine, PhantomJS and JenkinsAutomated Testing With Jasmine, PhantomJS and Jenkins
Automated Testing With Jasmine, PhantomJS and JenkinsWork at Play
 
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)Alvaro Sanchez-Mariscal
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascriptkhanhdang1214
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Brian Sam-Bodden
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...Applitools
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
 
Beyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsBeyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsSauce Labs
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Applitools
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumBrian Jordan
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Adam Christian
 

What's hot (20)

Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
 
Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
Introduction to jest
Introduction to jestIntroduction to jest
Introduction to jest
 
Selenium for Jobseekers
Selenium for JobseekersSelenium for Jobseekers
Selenium for Jobseekers
 
Protractor training
Protractor trainingProtractor training
Protractor training
 
Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
Automated Testing With Jasmine, PhantomJS and Jenkins
Automated Testing With Jasmine, PhantomJS and JenkinsAutomated Testing With Jasmine, PhantomJS and Jenkins
Automated Testing With Jasmine, PhantomJS and Jenkins
 
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascript
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Beyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsBeyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms Organizations
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS Curriculum
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011
 

Viewers also liked

Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshopcoreyjack
 
KraQA #22, Filip Cynarski - Selenium Grid w chmurze Amazon Web Services
KraQA #22, Filip Cynarski -  Selenium Grid w chmurze Amazon Web ServicesKraQA #22, Filip Cynarski -  Selenium Grid w chmurze Amazon Web Services
KraQA #22, Filip Cynarski - Selenium Grid w chmurze Amazon Web Serviceskraqa
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object patternMichael Palotas
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Gridnirvdrum
 
Selenium grid workshop london 2016
Selenium grid workshop london 2016Selenium grid workshop london 2016
Selenium grid workshop london 2016Marcus Merrell
 
Continuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerContinuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerBarbara Gonzalez
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Atirek Gupta
 
BDD with JBehave and Selenium
BDD with JBehave and SeleniumBDD with JBehave and Selenium
BDD with JBehave and SeleniumNikolay Vasilev
 

Viewers also liked (10)

Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Sakai10 Selenium Workshop
Sakai10 Selenium WorkshopSakai10 Selenium Workshop
Sakai10 Selenium Workshop
 
KraQA #22, Filip Cynarski - Selenium Grid w chmurze Amazon Web Services
KraQA #22, Filip Cynarski -  Selenium Grid w chmurze Amazon Web ServicesKraQA #22, Filip Cynarski -  Selenium Grid w chmurze Amazon Web Services
KraQA #22, Filip Cynarski - Selenium Grid w chmurze Amazon Web Services
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object pattern
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Grid
 
Selenium grid workshop london 2016
Selenium grid workshop london 2016Selenium grid workshop london 2016
Selenium grid workshop london 2016
 
Continuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerContinuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And Docker
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
BDD with JBehave and Selenium
BDD with JBehave and SeleniumBDD with JBehave and Selenium
BDD with JBehave and Selenium
 

Similar to Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Belarus

Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternSQALab
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Designing for the internet - Page Objects for the Real World
Designing for the internet - Page Objects for the Real WorldDesigning for the internet - Page Objects for the Real World
Designing for the internet - Page Objects for the Real WorldQualitest
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advancedUsama Nada
 
Qtp certification training_material
Qtp certification training_materialQtp certification training_material
Qtp certification training_materialVishwaprakash Sahoo
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8Heartin Jacob
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)Igor Talevski
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automationElias Nogueira
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Angular Unit testing.pptx
Angular Unit testing.pptxAngular Unit testing.pptx
Angular Unit testing.pptxRiyaBangera
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupDave Haeffner
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
Enhancing Website and Application Testing with Java Scrapers.pdf
Enhancing Website and Application Testing with Java Scrapers.pdfEnhancing Website and Application Testing with Java Scrapers.pdf
Enhancing Website and Application Testing with Java Scrapers.pdfAnanthReddy38
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 
Introducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdfIntroducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdfApplitools
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectKnoldus Inc.
 

Similar to Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Belarus (20)

Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Designing for the internet - Page Objects for the Real World
Designing for the internet - Page Objects for the Real WorldDesigning for the internet - Page Objects for the Real World
Designing for the internet - Page Objects for the Real World
 
Selenium training in chennai
Selenium training in chennaiSelenium training in chennai
Selenium training in chennai
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advanced
 
Qtp certification training_material
Qtp certification training_materialQtp certification training_material
Qtp certification training_material
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
 
Unit Testing in Swift
Unit Testing in SwiftUnit Testing in Swift
Unit Testing in Swift
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Angular Unit testing.pptx
Angular Unit testing.pptxAngular Unit testing.pptx
Angular Unit testing.pptx
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
Enhancing Website and Application Testing with Java Scrapers.pdf
Enhancing Website and Application Testing with Java Scrapers.pdfEnhancing Website and Application Testing with Java Scrapers.pdf
Enhancing Website and Application Testing with Java Scrapers.pdf
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
Introducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdfIntroducing the Applitools Self Healing Execution Cloud.pdf
Introducing the Applitools Self Healing Execution Cloud.pdf
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala Project
 

More from Sargis Sargsyan

Let’s Talk About Quality Engineering
Let’s Talk About Quality EngineeringLet’s Talk About Quality Engineering
Let’s Talk About Quality EngineeringSargis Sargsyan
 
Your Road to Quality Assurance
Your Road to Quality AssuranceYour Road to Quality Assurance
Your Road to Quality AssuranceSargis Sargsyan
 
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019Sargis Sargsyan
 
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019Sargis Sargsyan
 
Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019Sargis Sargsyan
 
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...Sargis Sargsyan
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerSargis Sargsyan
 
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...Sargis Sargsyan
 
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint Petersburg
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint PetersburgTest Data Preparation: Tips and Tricks - SQA Days 22 - Saint Petersburg
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint PetersburgSargis Sargsyan
 
Web Application Testing with Selenium
Web Application Testing with Selenium Web Application Testing with Selenium
Web Application Testing with Selenium Sargis Sargsyan
 
QA MeetUp Yerevan - Aug 25
QA MeetUp Yerevan - Aug 25QA MeetUp Yerevan - Aug 25
QA MeetUp Yerevan - Aug 25Sargis Sargsyan
 

More from Sargis Sargsyan (11)

Let’s Talk About Quality Engineering
Let’s Talk About Quality EngineeringLet’s Talk About Quality Engineering
Let’s Talk About Quality Engineering
 
Your Road to Quality Assurance
Your Road to Quality AssuranceYour Road to Quality Assurance
Your Road to Quality Assurance
 
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019
Appium Dockerization: from Scratch to Advanced Implementation - HUSTEF 2019
 
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019
Getting Started with Dockerization of Selenium Tests Execution - Testwarez 2019
 
Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019Run your Appium tests using Docker Android - AppiumConf 2019
Run your Appium tests using Docker Android - AppiumConf 2019
 
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...
How to Dockerize Parallel Execution of Selenium Tests - SQA Days EU, Rgia, La...
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
 
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...
Make Your Selenium Suite Faster and Reliable: Test Setup with REST APIs - SQA...
 
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint Petersburg
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint PetersburgTest Data Preparation: Tips and Tricks - SQA Days 22 - Saint Petersburg
Test Data Preparation: Tips and Tricks - SQA Days 22 - Saint Petersburg
 
Web Application Testing with Selenium
Web Application Testing with Selenium Web Application Testing with Selenium
Web Application Testing with Selenium
 
QA MeetUp Yerevan - Aug 25
QA MeetUp Yerevan - Aug 25QA MeetUp Yerevan - Aug 25
QA MeetUp Yerevan - Aug 25
 

Recently uploaded

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Belarus

  • 1. Better Page Object Handling with Loadable Component Pattern Sargis Sargsyan SQA Days, Belarus, 2016
  • 2. ‹ ›2 Loadable Component 4 Introduction 1 Page Object Pattern 2 Wait in Selenium 3 Q & A 8 Common Failures 7 Implementation on existing project 6 Main Topics Slow Loadable Component 5
  • 3. ‹ ›3 Demos • Demos are in Java! • Everything we discuss is applicable strongly- typed languages (e.g. C#) • Most things are applicable to dynamically- typed languages (e.g. Ruby, Python, Perl)
  • 4. ‹ ›4 Demos will use also • Maven • TestNG • Selenium
  • 6. ‹ ›6 What is Page Object Pattern • Page Objects Framework is a design pattern which has become popular in test automation for making easy test maintenance and reducing code duplication. This design pattern, to interact or work with a web page, we have an object-oriented class for that web. Then the tests calls the methods of this page class by creating a page object whenever they need to interact or work with that web page. 7 q 1Z a
  • 7. ‹ ›7 What is Page Object Pattern • For example web application or website that has multiple web pages and each page offers different services and functionalities. • There are different pages like • Home page, • Login page, • Registration page. • Each page offers a specific set of services. Services offered by Login page Login by entering user name and password We can get page title A class to represent Login page is like
  • 8. ‹ ›8 What is Page Object Pattern • In page objects framework: • Each page in the web application/website we consider as an object. • Each webpage in the web application is represented by a Class • Each service/functionality offered by a webpage is represented by a method in the respective page class We will be having our tests calling these methods by creating objects of page classes
  • 9. ‹ ›9 Why we should use Page Objects Pattern 1 Promotes reuse and refuses duplication 2 Makes tests more readable and robust 3 Makes tests less brittle 4 Improves maintainability, Particularly when there is frequent changes 5 If UI change, tests don’t need to be change, only the code within the page object need to be changed. 6 Handle of each page using its instance
  • 10. ‹ ›10 How does it structured? • Each page is defined as it’s own class. • Actions (including navigation) are represented as functions for a class. • Each function can return a new Page object (navigating between pages), • Tests only talk to the page objects. • Page objects only talk to the Base Object. • Base Object talks to only driver. • Elements on the page are stored as variables for the page object
  • 11. ‹ ›11 Selenium Model Test Case 1 Test Case 2 Test Case … ReportSelenium Web app Web PageWeb PageWeb PageWeb PageBrowsers
  • 12. ‹ ›12 Page Object Model Page Objects Test Case 1 Test Case 2 Test Case … Report Selenium Web app Web PageWeb PageWeb PageWeb PageBrowsers
  • 13. ‹ ›13 Page Object Model & Base Page Page Objects Test Case 1 Test Case 2 Test Case … Report Base Page Selenium Web app Web PageWeb PageWeb PageWeb PageBrowsers
  • 15. ‹ ›15 How it looks like
  • 22. ‹ ›22 Why to wait? • When automating an application you must wait for a transaction to complete before proceeding to your next action. • Sleeps should never be a version for an alternative to waits. Sleeps will ALWAYS wait the exact amount of time even if the application is ready to continue the test.
  • 23. ‹ ›23 Wait as long as necessary • We should wait as long as necessary which saves you precious time on your execution. • Selenium Offers 3 wait types: • Implicit Waits • Explicit Waits • Fluent Waits [
  • 24. ‹ ›24 Implicit Waits • Implicit waits apply globally to every find element call. • undocumented and practically undefined behavior • Runs in the remote part of selenium (the part controlling the browser). • Only works on find element(s) methods. • Returns either element found or (after timeout) not found. • If checking for absence of element must always wait until timeout. • Cannot be customized other than global timeout. • Best practice is to not use implicit waits if possible.
  • 25. ‹ ›25 Explicit Waits • Documented and defined behavior • Explicit waits ping the application every 500ms checking for the condition of the wait to be true • Runs in the local part of selenium (in the language of your code) • Works on any condition you can think of • Returns either success or timeout error • Can define absence of element as success condition • Can customize delay between retries and exceptions to ignore
  • 27. ‹ ›27 Fluent Waits • Fluent waits require that you define the wait between checks of the application for an object/condition as well as the overall timeout of the transaction. Additionally you must tell fluent waits not to throw an exception when they don’t find an object as best practice.
  • 29. ‹ ›29 What is the LoadableComponent? • The LoadableComponent is a base class that aims to make writing PageObjects less painful. It does this by providing a standard way of ensuring that pages are loaded and providing hooks to make debugging the failure of a page to load easier. You can use it to help reduce the amount of boilerplate code in your tests, which in turn make maintaining your tests less tiresome. • There is currently an implementation in Java that ships as part of Selenium 2, but the approach used is simple enough to be implemented in any language. *Selenium Wiki
  • 30. ‹ ›30 What is it? • LoadableComponent is a base class in Selenium, which means that you can simply define your Page Objects as an extension of the LoadableComponent class. So, for example, we can simply define a LoginPage object as follows:
  • 31. ‹ ›31 How to use • The Loadable Component Pattern also allows you to model your page objects as a tree of nested components. • Allows better way to manage navigations between pages • Uses the “load” method that is used to navigate to the page and the “isLoaded” method which is used to determine if we are on the right page.
  • 33. ‹ ›33 load() and inLoaded() methods
  • 35. ‹ ›35 isLoaded() with PageLoadHelper
  • 36. ‹ ›36 Extend LoadableComponent in Base Object class
  • 37. ‹ ›37 Custom Loadable Component Implementation
  • 39. ‹ ›39 What is the SlowLoadableComponent? • The SlowLoadableComponent is a sub class of LoadableComponent. • get() for SlowLoadableComponent will ensure that the component is currently. • isError() method will check for well known error cases, which would mean that loading has finished, but an error condition was seen. • waitFor() method will wait to run the next time. After a call to load(), the isLoaded() method will continue to fail until the component has fully loaded.
  • 43. ‹ ›43 Changes in Base Page
  • 44. ‹ ›44 Changes in Page Object
  • 48. ‹ ›48 Not Building a Framework
  • 49. ‹ ›49 Use unique selectors
  • 50. ‹ ›50 Do not use Retry y
  • 51. ‹ ›51 Do not try to Automate Hard Things
  • 52. ‹ ›52 Run test in Continuous Integration 1 Have a plan and stick to it 2 Run test as part of build 3 Run test locally 4 Report results 5 Break builds
  • 53. ✉ ! EMAIL TWITTER LINKEDIN mrsargsyan sargissargsyan Contacts ą Thank You! sargis.sargsyan@live.com