SlideShare a Scribd company logo
Hands-on guide to
Object Identification
Speaker : Dharmesh Vaya
Presented On : 24.06.2016
Twitter : @DRVaya
Web : http://drvaya.wordpress.com/
Test Automation Consultant with 10+ yrs experience
Expertise with designing/development of Selenium
based Automation frameworks (as well as other tools)
Speaker at various forums - Google DevFests, Selenium
Conference
Trainer/Mentor - to different MNCs/Startups.
Dharmesh Vaya
a.k.a.
Dharam
Agenda
★ Basics of Object Identification
★ What are CSS Selectors/Locator’s ?
★ What are Xpath Locators ?
★ Let’s go advanced …
★ Cheat Sheet
★ Best Practices from experience
Basics of
Object Identification
Approach ...
★ More than locators you need to understand the underlying
Web development techniques.
★ Carefully understand the page source and identify the libraries
used. This will help in building robust scripts.
★ Using Firebug/Developer tools.
★ Test your element even before you do it with Selenium.
(Developer toolbars are meant for that).
★ Ultimately, Locators come first, Logic is secondary and will be
built upon the locators.
What are
CSS Selectors/Locator’s?
CSS Selectors...
★ Absolute Selectors
World -> Continent -> Country -> State -> City -> Street
★ Relative Selectors
Street Number or House Number
★ Class or ID based Selectors
★ Finding using other attributes
★ Partial Matching
What are
Xpath Locator’s ?
Xpath Locators...
★ Absolute Xpath
World -> Continent -> Country -> State -> City -> Street
★ Relative Xpath
Street Number or House Number
★ Index based Xpath
★ Finding using other attributes
★ Partial Matching
Let’s go advanced..
Complex Selectors
★ Partial Matching
Description CSS Xpath
Starting with ^= starts-with()
Ending with $= ends-with()
Contains *= contains()
Few more, Complex Selectors
★ Elements based on relationships
Xpath : ancestor, descendent, preceding, following
CSS: :first-child, :last-child, :nth-child(n)
★ Based on UI state
CSS: enabled, disabled, checked, :not()
Cheat Sheet
Handy Reference for CSS/Xpath
Approach Description/HTML CSS Xpath
Finding by ID <input id='user'> input#user //input[@id='user']
Finding by Class <input class='user'> input.user //input[@class='user']
Any attribute <input name='text'> input[name='text'] //input[@name='text']
Direct Child <ul> has several <li> ul > li //ul/li
Any Child/Grandchild <ul> has several <li> ul li //ul//li
nth-child 4th <li> from <ul> ul li:nth-of-type(4) //ul/li[4]
Direct Parent <ul> is parent of <li class='active'> li.active:parent //li[@class='active']/..
Next Sibling 2nd <li> tag from several <li> tags li.active + li //li[@class='active']/../li[2]
By Text Link with Sign In text a:contains('Sign In') //a[contains(text(), 'Sign In')]
Best Practices from
Experience
Make scripts more robust...
★ Avoid fragile selectors like ones having numbers or text that
appears to be variable
★ Don’t rely on a hierarchy of elements above 3-4 levels
★ Avoid using more than 2 attributes for a composite selector
★ Ensure the selectors in all browsers using the console
★ Store Element locators outside your classes … Excel/XML/Text
anywhere but not in your code.
★ At times, you may avoid GUI automation too !!!
Happy to answer any questions/queries
related to Automation testing …..
Slides will be available on -
http://drvaya.wordpress.com/

More Related Content

Viewers also liked

Trabalho De Ingles
Trabalho De InglesTrabalho De Ingles
Trabalho De Ingles
guesta66cf0
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non Static
Abdul Rahman Sherzad
 
Lecture 2 introduction to Software Engineering 1
Lecture 2   introduction to Software Engineering 1Lecture 2   introduction to Software Engineering 1
Lecture 2 introduction to Software Engineering 1
IIUI
 
Software Engineering 2 lecture slide
Software Engineering 2 lecture slideSoftware Engineering 2 lecture slide
Software Engineering 2 lecture slide
Adil Mehmoood
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
D Nayanathara
 
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
1-Introduction to Software Engineering (Object Oriented Software Engineering ...1-Introduction to Software Engineering (Object Oriented Software Engineering ...
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
Hafiz Ammar Siddiqui
 
Object Modelling in Software Engineering
Object Modelling in Software EngineeringObject Modelling in Software Engineering
Object Modelling in Software Engineering
guest7fe55d5e
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
smj
 
Software Engineering unit 2
Software Engineering unit 2Software Engineering unit 2
Software Engineering unit 2
Abhimanyu Mishra
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented concepts
Maryo Manjaruni
 
Exploring BigData with Google BigQuery
Exploring BigData with Google BigQueryExploring BigData with Google BigQuery
Exploring BigData with Google BigQuery
Dharmesh Vaya
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software Engineering
Ali Haider
 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
 
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
op205
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its management
Vinay Kumar Pulabaigari
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
BG Java EE Course
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
Komal Singh
 

Viewers also liked (17)

Trabalho De Ingles
Trabalho De InglesTrabalho De Ingles
Trabalho De Ingles
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non Static
 
Lecture 2 introduction to Software Engineering 1
Lecture 2   introduction to Software Engineering 1Lecture 2   introduction to Software Engineering 1
Lecture 2 introduction to Software Engineering 1
 
Software Engineering 2 lecture slide
Software Engineering 2 lecture slideSoftware Engineering 2 lecture slide
Software Engineering 2 lecture slide
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
 
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
1-Introduction to Software Engineering (Object Oriented Software Engineering ...1-Introduction to Software Engineering (Object Oriented Software Engineering ...
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
 
Object Modelling in Software Engineering
Object Modelling in Software EngineeringObject Modelling in Software Engineering
Object Modelling in Software Engineering
 
Object Oriented Concept
Object Oriented ConceptObject Oriented Concept
Object Oriented Concept
 
Software Engineering unit 2
Software Engineering unit 2Software Engineering unit 2
Software Engineering unit 2
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented concepts
 
Exploring BigData with Google BigQuery
Exploring BigData with Google BigQueryExploring BigData with Google BigQuery
Exploring BigData with Google BigQuery
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software Engineering
 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
 
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
 
Object identification and its management
Object identification and its managementObject identification and its management
Object identification and its management
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 

Similar to Hands-on Guide to Object Identification

New Features of Chropath for XPath and CSS Selectors | Edureka
New Features of Chropath for XPath and CSS Selectors | EdurekaNew Features of Chropath for XPath and CSS Selectors | Edureka
New Features of Chropath for XPath and CSS Selectors | Edureka
Edureka!
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & css
sesharao puvvada
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
GuruPada Das
 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
Rachel Andrew
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Shane Church
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
Zohar Arad
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
p4geoff
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
ghnash
 
Understanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdfUnderstanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdf
pCloudy
 
Chrome DevTools Introduction 2020 Web Developers Guide
Chrome DevTools Introduction 2020 Web Developers GuideChrome DevTools Introduction 2020 Web Developers Guide
Chrome DevTools Introduction 2020 Web Developers Guide
Laurence Svekis ✔
 
Less css
Less cssLess css
Less css
Amit kumar
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Scott DeLoach
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
Gábor Hojtsy
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQuery
Toni Kolev
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
Marakana Inc.
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
Marakana Inc.
 
PhDigital Bootcamp: Web Development Concepts
PhDigital Bootcamp: Web Development ConceptsPhDigital Bootcamp: Web Development Concepts
PhDigital Bootcamp: Web Development Concepts
Cindy Royal
 
SharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentialsSharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentials
Mark Rackley
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
Bedis ElAchèche
 
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Scott DeLoach
 

Similar to Hands-on Guide to Object Identification (20)

New Features of Chropath for XPath and CSS Selectors | Edureka
New Features of Chropath for XPath and CSS Selectors | EdurekaNew Features of Chropath for XPath and CSS Selectors | Edureka
New Features of Chropath for XPath and CSS Selectors | Edureka
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & css
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
 
Railsbridge javascript
Railsbridge   javascriptRailsbridge   javascript
Railsbridge javascript
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
Understanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdfUnderstanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdf
 
Chrome DevTools Introduction 2020 Web Developers Guide
Chrome DevTools Introduction 2020 Web Developers GuideChrome DevTools Introduction 2020 Web Developers Guide
Chrome DevTools Introduction 2020 Web Developers Guide
 
Less css
Less cssLess css
Less css
 
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStartExtreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
Extreme CSS Techniques - MadWorld Europe 2018, Scott DeLoach, ClickStart
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
 
FFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQueryFFW Gabrovo PMG - jQuery
FFW Gabrovo PMG - jQuery
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
PhDigital Bootcamp: Web Development Concepts
PhDigital Bootcamp: Web Development ConceptsPhDigital Bootcamp: Web Development Concepts
PhDigital Bootcamp: Web Development Concepts
 
SharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentialsSharePoint Cincy 2012 - jQuery essentials
SharePoint Cincy 2012 - jQuery essentials
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
 

Recently uploaded

Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 

Recently uploaded (20)

Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 

Hands-on Guide to Object Identification

  • 1. Hands-on guide to Object Identification Speaker : Dharmesh Vaya Presented On : 24.06.2016 Twitter : @DRVaya Web : http://drvaya.wordpress.com/
  • 2. Test Automation Consultant with 10+ yrs experience Expertise with designing/development of Selenium based Automation frameworks (as well as other tools) Speaker at various forums - Google DevFests, Selenium Conference Trainer/Mentor - to different MNCs/Startups. Dharmesh Vaya a.k.a. Dharam
  • 3. Agenda ★ Basics of Object Identification ★ What are CSS Selectors/Locator’s ? ★ What are Xpath Locators ? ★ Let’s go advanced … ★ Cheat Sheet ★ Best Practices from experience
  • 5. Approach ... ★ More than locators you need to understand the underlying Web development techniques. ★ Carefully understand the page source and identify the libraries used. This will help in building robust scripts. ★ Using Firebug/Developer tools. ★ Test your element even before you do it with Selenium. (Developer toolbars are meant for that). ★ Ultimately, Locators come first, Logic is secondary and will be built upon the locators.
  • 7. CSS Selectors... ★ Absolute Selectors World -> Continent -> Country -> State -> City -> Street ★ Relative Selectors Street Number or House Number ★ Class or ID based Selectors ★ Finding using other attributes ★ Partial Matching
  • 9. Xpath Locators... ★ Absolute Xpath World -> Continent -> Country -> State -> City -> Street ★ Relative Xpath Street Number or House Number ★ Index based Xpath ★ Finding using other attributes ★ Partial Matching
  • 11. Complex Selectors ★ Partial Matching Description CSS Xpath Starting with ^= starts-with() Ending with $= ends-with() Contains *= contains()
  • 12. Few more, Complex Selectors ★ Elements based on relationships Xpath : ancestor, descendent, preceding, following CSS: :first-child, :last-child, :nth-child(n) ★ Based on UI state CSS: enabled, disabled, checked, :not()
  • 14. Handy Reference for CSS/Xpath Approach Description/HTML CSS Xpath Finding by ID <input id='user'> input#user //input[@id='user'] Finding by Class <input class='user'> input.user //input[@class='user'] Any attribute <input name='text'> input[name='text'] //input[@name='text'] Direct Child <ul> has several <li> ul > li //ul/li Any Child/Grandchild <ul> has several <li> ul li //ul//li nth-child 4th <li> from <ul> ul li:nth-of-type(4) //ul/li[4] Direct Parent <ul> is parent of <li class='active'> li.active:parent //li[@class='active']/.. Next Sibling 2nd <li> tag from several <li> tags li.active + li //li[@class='active']/../li[2] By Text Link with Sign In text a:contains('Sign In') //a[contains(text(), 'Sign In')]
  • 16. Make scripts more robust... ★ Avoid fragile selectors like ones having numbers or text that appears to be variable ★ Don’t rely on a hierarchy of elements above 3-4 levels ★ Avoid using more than 2 attributes for a composite selector ★ Ensure the selectors in all browsers using the console ★ Store Element locators outside your classes … Excel/XML/Text anywhere but not in your code. ★ At times, you may avoid GUI automation too !!!
  • 17. Happy to answer any questions/queries related to Automation testing ….. Slides will be available on - http://drvaya.wordpress.com/