SlideShare une entreprise Scribd logo
1  sur  53
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
‹ ›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

Contenu connexe

Tendances

Scalable JavaScript Application Architecture
Scalable JavaScript Application ArchitectureScalable JavaScript Application Architecture
Scalable JavaScript Application ArchitectureNicholas Zakas
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Adnan Sohail
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST APIFabien Vauchelles
 
Functional Tests Automation with Robot Framework
Functional Tests Automation with Robot FrameworkFunctional Tests Automation with Robot Framework
Functional Tests Automation with Robot Frameworklaurent bristiel
 
Java Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkJava Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkArun Mehra
 
Chapter1 introduction to asp.net
Chapter1  introduction to asp.netChapter1  introduction to asp.net
Chapter1 introduction to asp.netmentorrbuddy
 
Handling iframes using selenium web driver
Handling iframes using selenium web driverHandling iframes using selenium web driver
Handling iframes using selenium web driverPankaj Biswas
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentationguest11106b
 
위험기반테스트접근 테스트계획 사례
위험기반테스트접근 테스트계획 사례위험기반테스트접근 테스트계획 사례
위험기반테스트접근 테스트계획 사례SangIn Choung
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentationritika1
 
Spring framework Controllers and Annotations
Spring framework   Controllers and AnnotationsSpring framework   Controllers and Annotations
Spring framework Controllers and AnnotationsAnuj Singh Rajput
 

Tendances (20)

Scalable JavaScript Application Architecture
Scalable JavaScript Application ArchitectureScalable JavaScript Application Architecture
Scalable JavaScript Application Architecture
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
Spring annotation
Spring annotationSpring annotation
Spring annotation
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Spring framework aop
Spring framework aopSpring framework aop
Spring framework aop
 
Functional Tests Automation with Robot Framework
Functional Tests Automation with Robot FrameworkFunctional Tests Automation with Robot Framework
Functional Tests Automation with Robot Framework
 
Java Multithreading Using Executors Framework
Java Multithreading Using Executors FrameworkJava Multithreading Using Executors Framework
Java Multithreading Using Executors Framework
 
Chapter1 introduction to asp.net
Chapter1  introduction to asp.netChapter1  introduction to asp.net
Chapter1 introduction to asp.net
 
Ajax
AjaxAjax
Ajax
 
Handling iframes using selenium web driver
Handling iframes using selenium web driverHandling iframes using selenium web driver
Handling iframes using selenium web driver
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Cucumber ppt
Cucumber pptCucumber ppt
Cucumber ppt
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
위험기반테스트접근 테스트계획 사례
위험기반테스트접근 테스트계획 사례위험기반테스트접근 테스트계획 사례
위험기반테스트접근 테스트계획 사례
 
Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
Spring framework Controllers and Annotations
Spring framework   Controllers and AnnotationsSpring framework   Controllers and Annotations
Spring framework Controllers and Annotations
 

En vedette

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 PatternSargis Sargsyan
 
Автоматизация тестирования базы на примере PostgreSQL
Автоматизация тестирования базы на примере PostgreSQLАвтоматизация тестирования базы на примере PostgreSQL
Автоматизация тестирования базы на примере PostgreSQLSQALab
 
Тестирование мобильного приложения для Android с функцией геолокации
Тестирование мобильного приложения для Android с функцией геолокацииТестирование мобильного приложения для Android с функцией геолокации
Тестирование мобильного приложения для Android с функцией геолокацииSQALab
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Alan Richardson
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Oren Rubin
 
Test Cases - are they dead?
Test Cases - are they dead?Test Cases - are they dead?
Test Cases - are they dead?SQALab
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
The emotional intellect in testing
The emotional intellect in testingThe emotional intellect in testing
The emotional intellect in testingSQALab
 
Forget Quality!
Forget Quality!Forget Quality!
Forget Quality!SQALab
 
Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object PatternDante Briones
 
Help Me, I got a team of junior testers!
Help Me, I got a team of junior testers!Help Me, I got a team of junior testers!
Help Me, I got a team of junior testers!SQALab
 
Ответственность за качество в разных ИТ-проектах
Ответственность за качество в разных ИТ-проектахОтветственность за качество в разных ИТ-проектах
Ответственность за качество в разных ИТ-проектахSQALab
 
Управление хаосом, или как жить когда число тестов перевалило за десятки тысяч
Управление хаосом, или как жить когда число тестов перевалило за десятки тысячУправление хаосом, или как жить когда число тестов перевалило за десятки тысяч
Управление хаосом, или как жить когда число тестов перевалило за десятки тысячSQALab
 
Test Cases are dead, long live Checklists!
Test Cases are dead, long live Checklists!Test Cases are dead, long live Checklists!
Test Cases are dead, long live Checklists!SQALab
 
Автоматизация тестирования WEB API
Автоматизация тестирования WEB APIАвтоматизация тестирования WEB API
Автоматизация тестирования WEB APISQALab
 
Тестирование отклика Web-интерфейса с JMeter и Selenium
Тестирование отклика Web-интерфейса с JMeter и SeleniumТестирование отклика Web-интерфейса с JMeter и Selenium
Тестирование отклика Web-интерфейса с JMeter и SeleniumSQALab
 

En vedette (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
 
Beyond Page Objects
Beyond Page ObjectsBeyond Page Objects
Beyond Page Objects
 
Автоматизация тестирования базы на примере PostgreSQL
Автоматизация тестирования базы на примере PostgreSQLАвтоматизация тестирования базы на примере PostgreSQL
Автоматизация тестирования базы на примере PostgreSQL
 
Serenity and the Journey Pattern
Serenity and the Journey PatternSerenity and the Journey Pattern
Serenity and the Journey Pattern
 
Тестирование мобильного приложения для Android с функцией геолокации
Тестирование мобильного приложения для Android с функцией геолокацииТестирование мобильного приложения для Android с функцией геолокации
Тестирование мобильного приложения для Android с функцией геолокации
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014
 
Test Cases - are they dead?
Test Cases - are they dead?Test Cases - are they dead?
Test Cases - are they dead?
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
BDD Anti-patterns
BDD Anti-patternsBDD Anti-patterns
BDD Anti-patterns
 
The emotional intellect in testing
The emotional intellect in testingThe emotional intellect in testing
The emotional intellect in testing
 
Forget Quality!
Forget Quality!Forget Quality!
Forget Quality!
 
Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object Pattern
 
Help Me, I got a team of junior testers!
Help Me, I got a team of junior testers!Help Me, I got a team of junior testers!
Help Me, I got a team of junior testers!
 
Ответственность за качество в разных ИТ-проектах
Ответственность за качество в разных ИТ-проектахОтветственность за качество в разных ИТ-проектах
Ответственность за качество в разных ИТ-проектах
 
Управление хаосом, или как жить когда число тестов перевалило за десятки тысяч
Управление хаосом, или как жить когда число тестов перевалило за десятки тысячУправление хаосом, или как жить когда число тестов перевалило за десятки тысяч
Управление хаосом, или как жить когда число тестов перевалило за десятки тысяч
 
Test Cases are dead, long live Checklists!
Test Cases are dead, long live Checklists!Test Cases are dead, long live Checklists!
Test Cases are dead, long live Checklists!
 
Автоматизация тестирования WEB API
Автоматизация тестирования WEB APIАвтоматизация тестирования WEB API
Автоматизация тестирования WEB API
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Тестирование отклика Web-интерфейса с JMeter и Selenium
Тестирование отклика Web-интерфейса с JMeter и SeleniumТестирование отклика Web-интерфейса с JMeter и Selenium
Тестирование отклика Web-интерфейса с JMeter и Selenium
 

Similaire à Better Page Object Handling with Loadable Component Pattern

Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...
Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...
Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...Sargis Sargsyan
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorKasun Kodagoda
 
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
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
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
 
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
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advancedUsama Nada
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
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
 
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
 
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
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 
Angular Unit testing.pptx
Angular Unit testing.pptxAngular Unit testing.pptx
Angular Unit testing.pptxRiyaBangera
 
Project_Goibibo information technology automation testing.pptx
Project_Goibibo information technology automation testing.pptxProject_Goibibo information technology automation testing.pptx
Project_Goibibo information technology automation testing.pptxskhushi9980
 
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
 

Similaire à Better Page Object Handling with Loadable Component Pattern (20)

Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...
Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...
Better Page Object Handling with Loadable Component Pattern - SQA Days 20, Be...
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using Protractor
 
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
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
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)
 
Selenium training in chennai
Selenium training in chennaiSelenium training in chennai
Selenium training in chennai
 
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
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advanced
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
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
 
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
 
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
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
Angular Unit testing.pptx
Angular Unit testing.pptxAngular Unit testing.pptx
Angular Unit testing.pptx
 
Project_Goibibo information technology automation testing.pptx
Project_Goibibo information technology automation testing.pptxProject_Goibibo information technology automation testing.pptx
Project_Goibibo information technology automation testing.pptx
 
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
 

Plus de SQALab

Готовим стажировку
Готовим стажировкуГотовим стажировку
Готовим стажировкуSQALab
 
Куда приводят мечты? или Искусство развития тестировщика
Куда приводят мечты? или Искусство развития тестировщикаКуда приводят мечты? или Искусство развития тестировщика
Куда приводят мечты? или Искусство развития тестировщикаSQALab
 
Оптимизация Selenium тестов и ускорение их поддержки
Оптимизация Selenium тестов и ускорение их поддержкиОптимизация Selenium тестов и ускорение их поддержки
Оптимизация Selenium тестов и ускорение их поддержкиSQALab
 
Автоматизация 0.0: 0 - бюджет, 0 - опыт программирования
Автоматизация 0.0: 0 - бюджет, 0 - опыт программированияАвтоматизация 0.0: 0 - бюджет, 0 - опыт программирования
Автоматизация 0.0: 0 - бюджет, 0 - опыт программированияSQALab
 
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...SQALab
 
Continuous performance testing
Continuous performance testingContinuous performance testing
Continuous performance testingSQALab
 
Конфиги вместо костылей. Pytestconfig и зачем он нужен
Конфиги вместо костылей. Pytestconfig и зачем он нуженКонфиги вместо костылей. Pytestconfig и зачем он нужен
Конфиги вместо костылей. Pytestconfig и зачем он нуженSQALab
 
Команда чемпионов в ИТ стихии
Команда чемпионов в ИТ стихииКоманда чемпионов в ИТ стихии
Команда чемпионов в ИТ стихииSQALab
 
API. Серебряная пуля в магазине советов
API. Серебряная пуля в магазине советовAPI. Серебряная пуля в магазине советов
API. Серебряная пуля в магазине советовSQALab
 
Добиваемся эффективности каждого из 9000+ UI-тестов
Добиваемся эффективности каждого из 9000+ UI-тестовДобиваемся эффективности каждого из 9000+ UI-тестов
Добиваемся эффективности каждого из 9000+ UI-тестовSQALab
 
Делаем автоматизацию проектных KPIs
Делаем автоматизацию проектных KPIsДелаем автоматизацию проектных KPIs
Делаем автоматизацию проектных KPIsSQALab
 
Вредные привычки в тест-менеджменте
Вредные привычки в тест-менеджментеВредные привычки в тест-менеджменте
Вредные привычки в тест-менеджментеSQALab
 
Мощь переполняет с JDI 2.0 - новая эра UI автоматизации
Мощь переполняет с JDI 2.0 - новая эра UI автоматизацииМощь переполняет с JDI 2.0 - новая эра UI автоматизации
Мощь переполняет с JDI 2.0 - новая эра UI автоматизацииSQALab
 
Как hh.ru дошли до 500 релизов в квартал без потери в качестве
Как hh.ru дошли до 500 релизов в квартал без потери в качествеКак hh.ru дошли до 500 релизов в квартал без потери в качестве
Как hh.ru дошли до 500 релизов в квартал без потери в качествеSQALab
 
Стили лидерства и тестирование
Стили лидерства и тестированиеСтили лидерства и тестирование
Стили лидерства и тестированиеSQALab
 
"Давайте не будем про качество"
"Давайте не будем про качество""Давайте не будем про качество"
"Давайте не будем про качество"SQALab
 
Apache.JMeter для .NET-проектов
Apache.JMeter для .NET-проектовApache.JMeter для .NET-проектов
Apache.JMeter для .NET-проектовSQALab
 
Тестирование геолокационных систем
Тестирование геолокационных системТестирование геолокационных систем
Тестирование геолокационных системSQALab
 
Лидер или босс? Вот в чем вопрос
Лидер или босс? Вот в чем вопросЛидер или босс? Вот в чем вопрос
Лидер или босс? Вот в чем вопросSQALab
 
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...SQALab
 

Plus de SQALab (20)

Готовим стажировку
Готовим стажировкуГотовим стажировку
Готовим стажировку
 
Куда приводят мечты? или Искусство развития тестировщика
Куда приводят мечты? или Искусство развития тестировщикаКуда приводят мечты? или Искусство развития тестировщика
Куда приводят мечты? или Искусство развития тестировщика
 
Оптимизация Selenium тестов и ускорение их поддержки
Оптимизация Selenium тестов и ускорение их поддержкиОптимизация Selenium тестов и ускорение их поддержки
Оптимизация Selenium тестов и ускорение их поддержки
 
Автоматизация 0.0: 0 - бюджет, 0 - опыт программирования
Автоматизация 0.0: 0 - бюджет, 0 - опыт программированияАвтоматизация 0.0: 0 - бюджет, 0 - опыт программирования
Автоматизация 0.0: 0 - бюджет, 0 - опыт программирования
 
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...
Нагрузочное тестирование нестандартных протоколов с использованием Citrix и J...
 
Continuous performance testing
Continuous performance testingContinuous performance testing
Continuous performance testing
 
Конфиги вместо костылей. Pytestconfig и зачем он нужен
Конфиги вместо костылей. Pytestconfig и зачем он нуженКонфиги вместо костылей. Pytestconfig и зачем он нужен
Конфиги вместо костылей. Pytestconfig и зачем он нужен
 
Команда чемпионов в ИТ стихии
Команда чемпионов в ИТ стихииКоманда чемпионов в ИТ стихии
Команда чемпионов в ИТ стихии
 
API. Серебряная пуля в магазине советов
API. Серебряная пуля в магазине советовAPI. Серебряная пуля в магазине советов
API. Серебряная пуля в магазине советов
 
Добиваемся эффективности каждого из 9000+ UI-тестов
Добиваемся эффективности каждого из 9000+ UI-тестовДобиваемся эффективности каждого из 9000+ UI-тестов
Добиваемся эффективности каждого из 9000+ UI-тестов
 
Делаем автоматизацию проектных KPIs
Делаем автоматизацию проектных KPIsДелаем автоматизацию проектных KPIs
Делаем автоматизацию проектных KPIs
 
Вредные привычки в тест-менеджменте
Вредные привычки в тест-менеджментеВредные привычки в тест-менеджменте
Вредные привычки в тест-менеджменте
 
Мощь переполняет с JDI 2.0 - новая эра UI автоматизации
Мощь переполняет с JDI 2.0 - новая эра UI автоматизацииМощь переполняет с JDI 2.0 - новая эра UI автоматизации
Мощь переполняет с JDI 2.0 - новая эра UI автоматизации
 
Как hh.ru дошли до 500 релизов в квартал без потери в качестве
Как hh.ru дошли до 500 релизов в квартал без потери в качествеКак hh.ru дошли до 500 релизов в квартал без потери в качестве
Как hh.ru дошли до 500 релизов в квартал без потери в качестве
 
Стили лидерства и тестирование
Стили лидерства и тестированиеСтили лидерства и тестирование
Стили лидерства и тестирование
 
"Давайте не будем про качество"
"Давайте не будем про качество""Давайте не будем про качество"
"Давайте не будем про качество"
 
Apache.JMeter для .NET-проектов
Apache.JMeter для .NET-проектовApache.JMeter для .NET-проектов
Apache.JMeter для .NET-проектов
 
Тестирование геолокационных систем
Тестирование геолокационных системТестирование геолокационных систем
Тестирование геолокационных систем
 
Лидер или босс? Вот в чем вопрос
Лидер или босс? Вот в чем вопросЛидер или босс? Вот в чем вопрос
Лидер или босс? Вот в чем вопрос
 
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...
От Зефира в коробке к Structure Zephyr или как тест-менеджеру перекроить внут...
 

Dernier

Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

Dernier (20)

Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 

Better Page Object Handling with Loadable Component Pattern

  • 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
  • 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

Notes de l'éditeur

  1. -Selenium is hot in the test automation world. -Is it news to you? -If it is, you’re welcome, please remember were you heard it first! -Due to its popularity, Selenium has been the first solution for everybody looking to automate browser-based applications, even though sometimes it is not the best solution
  2. Waits are an extremely important part of Selenium automation. Without waits your automation will fail and when using Sleeps instead of waits your automation framework will be extremely slow. In the next slides you will find some of the differences between the various waits Selenium has to offer.
  3. load() and isLoaded() method
  4. using Invocations chain
  5. isError() throws java.lang.Error Check for well known error cases, which would mean that loading has finished, but an error condition was seen. If an error has occurred throw an Error, possibly by using JUnit's Assert.assert* methods
  6. Finding an element in the DOM can be one of the most challenging parts of a Selenium test. IDs provide a way for key elements to be uniquely identified within the entire product. In some of our original tests, we used XPaths, class paths, and other complex CSS selectors to locate important elements. However, when an element moved to a different place in the UI, or simply just changed its CSS class names (due to redesign or refactoring), updating the test required going back and finding that element again. With IDs, an element is identifiable regardless of where it is in the DOM and what styling is applied to it.
  7. Have a fun breaking and fixing the build