SlideShare a Scribd company logo
LOCATOR
STRATEGIES FOR
WEB ELEMENTS
WEB UI AUTOMATED TESTS
By Trong Bui - QA Architect at KMS Technology
LOCATOR STRATEGIES FOR WEB ELEMENTS
LOCATOR
▸ A way to find a Web element by Selenium
• Locator strategies: ID, Name, Link, DOM, XPath, etc.
▸ Challenges
• Unable to find elements
• Multiple elements matched
• Hard to maintain scripts
• Vulnerable to changes in the implementation of the AUT
LOCATOR STRATEGIES FOR WEB ELEMENTS
LOCATOR STRATEGIES
▸ This chart provides several useful locator strategies in
addition to the common ones, including
▸ Using Visual Text
▸ Detecting Component
LOCATOR STRATEGIES FOR WEB ELEMENTS
USING VISUAL TEXT
✤An element is located using its visual text such as title, label and caption instead of its
properties invisible by end users such as ID and index.
✤Pros
• Focusing on “What users see”
• Tests are more readable
• Visual texts are often specified in the requirements
• Avoiding unexpected changes in the back-end implementation
• Supporting localization
✤Cons
• Problems with localization
• Problems in dealing with Web Element relationships
LOCATOR STRATEGIES FOR WEB ELEMENTS
USING VISUAL TEXT
▸ Visual text appearing as
• Value
• Text
• Placeholder
• Bound label
LOCATOR STRATEGIES FOR WEB ELEMENTS
VALUE
<input accesskey="s" class="aui-button" id="login-form-submit" name="login"
title="Press Alt+s to submit this form" type="submit" value="Log In">
locator: //input[@value = ‘Log In’]
locator: //<tag>[@value = ‘<present text>’]
LOCATOR STRATEGIES FOR WEB ELEMENTS
TEXT
<button class="btn Searchbox__searchButton Searchbox__searchButton--active" data-sel
<span class="Searchbox__searchButton__text">Search</span>
</button>
locator: //span[(text() = 'Search' or . = 'Search')]
locator: //button[.=‘Search’]
locator: //<tag>[.=‘<present text>’]
LOCATOR STRATEGIES FOR WEB ELEMENTS
PLACE HOLDER
<input type="email" autocomplete="username"
class="_43sdyhr" id="email-signup-email" name="user[email]"
placeholder="Email address" value="">
locator: //input[@placeholder=‘Email address’]
locator: //<tag>[@placeholder=‘<present text>’]
LOCATOR STRATEGIES FOR WEB ELEMENTS
PLACE HOLDER<input type="text" class="_1lhx92j" aria-label="Check in"
id="checkin" name="checkin" value=“2018-05-15"
placeholder="Check in" autocomplete="off" aria-
describedby="DateInput__screen-reader-message-checkin">
locator: //input[@placeholder=‘Check in’]
locator: //<tag>[@placeholder=‘<present text>’]
LOCATOR STRATEGIES FOR WEB ELEMENTS
BOUND LABEL
<div class="field-group">
<label accesskey="u" for="login-form-username"><u>U</u>sername</label>
<input class="text medium-field" id="login-form-username" name="os_username" type="tex
</div>
locator: .//input[@id=//label[.=‘Username’]/@for]
locator: .//<tag>[@id=//label[.=‘<present text>’]/@for]
LOCATOR STRATEGIES FOR WEB ELEMENTS
BOUND LABEL
<div class="_9hxttoo">
<label class="_1m8bb6v" for="GeocompleteController-via-SearchBarV2-SearchBarV2">Where</label>
<div dir="ltr">
<div class="_v0d63vq"><div class="_ncmdki"><div class="_bp0th8"><div class="_1miobth"><svg viewBox="0
0 24 24" role="presentation" aria-hidden="true" focusable="false" style="" fill-
rule="evenodd"></path></svg></div></div></div><div class="_178faes">
<input type="text" autocomplete="off" class="_k3jto05" id="GeocompleteController-via-SearchBarV2-
SearchBarV2" name="query" placeholder="Try “Costa Blanca”" value=""></div>
</div>
</div></div>
locator: //input[@id=//label[.=‘Where’]/@for]
LOCATOR STRATEGIES FOR WEB ELEMENTS
DETECTING COMPONENT
▸ A component consists of related Web elements. Users view
a component as a whole instead of individual elements
• Examples are search result blocks, carousels
▸ A component is located as a whole instead of its individual
elements
LOCATOR STRATEGIES FOR WEB ELEMENTS
COMPONENT
<div class="_16nvkt52"><div class="_qgh1p4">
<button type="button" class="_6m75u2" aria-busy="false" data-veloute="explore-nav-card:/homes">
<div><div class="_112c092"><div class="_1thk0tsb"><div class="_e296pg" style="width: 96px; height:
72px;"><div class="_6ikqekk" style=""></div></div></div><div class="_ni9axhe"><div
class="_13lgpze"><div class="_1ho874em">
<span class="_1t073h8">Homes</span>
</div></div></div></div></div>
</button>
</div></div>
Locator: .//button[.//span[.=‘Homes’]]
LOCATOR STRATEGIES FOR WEB ELEMENTS
COMPONENT
LOCATOR STRATEGIES FOR WEB ELEMENTS
COMPONENT
Locator: .//div[@itemprop=itemListElement’][.//div[.=‘Penthouse Room Close
to Big Ben’]]
Thank you

More Related Content

What's hot

Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
RapidValue
 
Katalon studio vs selenium comparision
Katalon studio vs selenium comparisionKatalon studio vs selenium comparision
Katalon studio vs selenium comparision
Prabhusundar6
 
Katalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing teamKatalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing team
Katalon Studio
 
Katalon Studio - GUI Overview
Katalon Studio - GUI OverviewKatalon Studio - GUI Overview
Katalon Studio - GUI Overview
Katalon Studio
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Test cases
Test casesTest cases
Test cases
Chandra Maddigapu
 
Test automation process
Test automation processTest automation process
Test automation process
Bharathi Krishnamurthi
 
Test Automation: A Roadmap For Sucesss
Test Automation: A Roadmap For SucesssTest Automation: A Roadmap For Sucesss
Test Automation: A Roadmap For Sucesss
David O'Dowd
 
Agile Testing by Example
Agile Testing by ExampleAgile Testing by Example
Agile Testing by Example
Mikalai Alimenkou
 
The Developer Experience
The Developer ExperienceThe Developer Experience
The Developer Experience
Atlassian
 
Api Testing
Api TestingApi Testing
Api Testing
Vishwanath KC
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
Edureka!
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium locators: ID, Name,  xpath, CSS Selector advance methodsSelenium locators: ID, Name,  xpath, CSS Selector advance methods
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Pankaj Dubey
 
Non Functional Testing
Non Functional TestingNon Functional Testing
Non Functional Testing
Nishant Worah
 
Automation Testing Syllabus - Checklist
Automation Testing Syllabus - ChecklistAutomation Testing Syllabus - Checklist
Automation Testing Syllabus - Checklist
Sunil Kumar Gunasekaran
 
Refine your ci:cd pipeline with automated test
Refine your ci:cd pipeline with automated testRefine your ci:cd pipeline with automated test
Refine your ci:cd pipeline with automated test
Malang QA Community
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
Archana Krushnan
 
Data driven testing
Data driven testingData driven testing
Data driven testing
Đăng Minh
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
Mithilesh Singh
 
SELENIUM PPT.pdf
SELENIUM PPT.pdfSELENIUM PPT.pdf
SELENIUM PPT.pdf
RebelSnowball
 

What's hot (20)

Test Case Creation in Katalon Studio
Test Case Creation in Katalon StudioTest Case Creation in Katalon Studio
Test Case Creation in Katalon Studio
 
Katalon studio vs selenium comparision
Katalon studio vs selenium comparisionKatalon studio vs selenium comparision
Katalon studio vs selenium comparision
 
Katalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing teamKatalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing team
 
Katalon Studio - GUI Overview
Katalon Studio - GUI OverviewKatalon Studio - GUI Overview
Katalon Studio - GUI Overview
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Test cases
Test casesTest cases
Test cases
 
Test automation process
Test automation processTest automation process
Test automation process
 
Test Automation: A Roadmap For Sucesss
Test Automation: A Roadmap For SucesssTest Automation: A Roadmap For Sucesss
Test Automation: A Roadmap For Sucesss
 
Agile Testing by Example
Agile Testing by ExampleAgile Testing by Example
Agile Testing by Example
 
The Developer Experience
The Developer ExperienceThe Developer Experience
The Developer Experience
 
Api Testing
Api TestingApi Testing
Api Testing
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium locators: ID, Name,  xpath, CSS Selector advance methodsSelenium locators: ID, Name,  xpath, CSS Selector advance methods
Selenium locators: ID, Name, xpath, CSS Selector advance methods
 
Non Functional Testing
Non Functional TestingNon Functional Testing
Non Functional Testing
 
Automation Testing Syllabus - Checklist
Automation Testing Syllabus - ChecklistAutomation Testing Syllabus - Checklist
Automation Testing Syllabus - Checklist
 
Refine your ci:cd pipeline with automated test
Refine your ci:cd pipeline with automated testRefine your ci:cd pipeline with automated test
Refine your ci:cd pipeline with automated test
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
Data driven testing
Data driven testingData driven testing
Data driven testing
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
SELENIUM PPT.pdf
SELENIUM PPT.pdfSELENIUM PPT.pdf
SELENIUM PPT.pdf
 

Similar to Locator strategy for web elements | Katalon Studio

FrontendwebsitehtmljavacssInternship.pptx
FrontendwebsitehtmljavacssInternship.pptxFrontendwebsitehtmljavacssInternship.pptx
FrontendwebsitehtmljavacssInternship.pptx
aamanattar01
 
EVOLVE'13 | Enhance | Effective SEO | Paul Legan
EVOLVE'13 | Enhance | Effective SEO | Paul LeganEVOLVE'13 | Enhance | Effective SEO | Paul Legan
EVOLVE'13 | Enhance | Effective SEO | Paul Legan
Evolve The Adobe Digital Marketing Community
 
Search engine optimization (seo) courses in chandigarh
Search engine optimization (seo) courses in chandigarhSearch engine optimization (seo) courses in chandigarh
Search engine optimization (seo) courses in chandigarh
morphanimation
 
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
SEO Master LLC
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
crokitta
 
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
SEO Ghaziabad
 
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
Seo vaishali LLC
 
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.
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
Matt Raible
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
Mark Rackley
 
Apex & jQuery Mobile
Apex & jQuery MobileApex & jQuery Mobile
Apex & jQuery Mobile
Christian Rokitta
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
Mark Rackley
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
Rakesh Jha
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePoint
Marc D Anderson
 
Seo
SeoSeo
JQuery
JQueryJQuery
JQuery
JQueryJQuery
Search Engine Optimization (SEO)
Search Engine Optimization (SEO)Search Engine Optimization (SEO)
Search Engine Optimization (SEO)
Dennis Deacon
 
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksA Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
Hamlet Batista
 

Similar to Locator strategy for web elements | Katalon Studio (20)

FrontendwebsitehtmljavacssInternship.pptx
FrontendwebsitehtmljavacssInternship.pptxFrontendwebsitehtmljavacssInternship.pptx
FrontendwebsitehtmljavacssInternship.pptx
 
EVOLVE'13 | Enhance | Effective SEO | Paul Legan
EVOLVE'13 | Enhance | Effective SEO | Paul LeganEVOLVE'13 | Enhance | Effective SEO | Paul Legan
EVOLVE'13 | Enhance | Effective SEO | Paul Legan
 
Search engine optimization (seo) courses in chandigarh
Search engine optimization (seo) courses in chandigarhSearch engine optimization (seo) courses in chandigarh
Search engine optimization (seo) courses in chandigarh
 
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
Search Engine Optimization courses in ghaziabad, Search engine Optimization t...
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
Search engine optimization,Best SEO institute in Ghaziabad,SEO Courses in Gha...
 
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
Search engine optimization ,seo in vashali,seo training in Mohan nagar,seo in...
 
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
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
 
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePointSPTechCon Boston 2015 - Utilizing jQuery in SharePoint
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
 
Apex & jQuery Mobile
Apex & jQuery MobileApex & jQuery Mobile
Apex & jQuery Mobile
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePoint
 
Seo
SeoSeo
Seo
 
JQuery
JQueryJQuery
JQuery
 
JQuery
JQueryJQuery
JQuery
 
Search Engine Optimization (SEO)
Search Engine Optimization (SEO)Search Engine Optimization (SEO)
Search Engine Optimization (SEO)
 
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript FrameworksA Deep Dive Into SEO Tactics For Modern Javascript Frameworks
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
 

Recently uploaded

Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
dhavalvaghelanectarb
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
KrishnaveniMohan1
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
ICS
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
Paul Brebner
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
Alina Yurenko
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
OnePlan Solutions
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
kalichargn70th171
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 

Recently uploaded (20)

Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024Flutter vs. React Native: A Detailed Comparison for App Development in 2024
Flutter vs. React Native: A Detailed Comparison for App Development in 2024
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfSoftware Test Automation - A Comprehensive Guide on Automated Testing.pdf
Software Test Automation - A Comprehensive Guide on Automated Testing.pdf
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 

Locator strategy for web elements | Katalon Studio

  • 1. LOCATOR STRATEGIES FOR WEB ELEMENTS WEB UI AUTOMATED TESTS By Trong Bui - QA Architect at KMS Technology
  • 2. LOCATOR STRATEGIES FOR WEB ELEMENTS LOCATOR ▸ A way to find a Web element by Selenium • Locator strategies: ID, Name, Link, DOM, XPath, etc. ▸ Challenges • Unable to find elements • Multiple elements matched • Hard to maintain scripts • Vulnerable to changes in the implementation of the AUT
  • 3. LOCATOR STRATEGIES FOR WEB ELEMENTS LOCATOR STRATEGIES ▸ This chart provides several useful locator strategies in addition to the common ones, including ▸ Using Visual Text ▸ Detecting Component
  • 4. LOCATOR STRATEGIES FOR WEB ELEMENTS USING VISUAL TEXT ✤An element is located using its visual text such as title, label and caption instead of its properties invisible by end users such as ID and index. ✤Pros • Focusing on “What users see” • Tests are more readable • Visual texts are often specified in the requirements • Avoiding unexpected changes in the back-end implementation • Supporting localization ✤Cons • Problems with localization • Problems in dealing with Web Element relationships
  • 5. LOCATOR STRATEGIES FOR WEB ELEMENTS USING VISUAL TEXT ▸ Visual text appearing as • Value • Text • Placeholder • Bound label
  • 6. LOCATOR STRATEGIES FOR WEB ELEMENTS VALUE <input accesskey="s" class="aui-button" id="login-form-submit" name="login" title="Press Alt+s to submit this form" type="submit" value="Log In"> locator: //input[@value = ‘Log In’] locator: //<tag>[@value = ‘<present text>’]
  • 7. LOCATOR STRATEGIES FOR WEB ELEMENTS TEXT <button class="btn Searchbox__searchButton Searchbox__searchButton--active" data-sel <span class="Searchbox__searchButton__text">Search</span> </button> locator: //span[(text() = 'Search' or . = 'Search')] locator: //button[.=‘Search’] locator: //<tag>[.=‘<present text>’]
  • 8. LOCATOR STRATEGIES FOR WEB ELEMENTS PLACE HOLDER <input type="email" autocomplete="username" class="_43sdyhr" id="email-signup-email" name="user[email]" placeholder="Email address" value=""> locator: //input[@placeholder=‘Email address’] locator: //<tag>[@placeholder=‘<present text>’]
  • 9. LOCATOR STRATEGIES FOR WEB ELEMENTS PLACE HOLDER<input type="text" class="_1lhx92j" aria-label="Check in" id="checkin" name="checkin" value=“2018-05-15" placeholder="Check in" autocomplete="off" aria- describedby="DateInput__screen-reader-message-checkin"> locator: //input[@placeholder=‘Check in’] locator: //<tag>[@placeholder=‘<present text>’]
  • 10. LOCATOR STRATEGIES FOR WEB ELEMENTS BOUND LABEL <div class="field-group"> <label accesskey="u" for="login-form-username"><u>U</u>sername</label> <input class="text medium-field" id="login-form-username" name="os_username" type="tex </div> locator: .//input[@id=//label[.=‘Username’]/@for] locator: .//<tag>[@id=//label[.=‘<present text>’]/@for]
  • 11. LOCATOR STRATEGIES FOR WEB ELEMENTS BOUND LABEL <div class="_9hxttoo"> <label class="_1m8bb6v" for="GeocompleteController-via-SearchBarV2-SearchBarV2">Where</label> <div dir="ltr"> <div class="_v0d63vq"><div class="_ncmdki"><div class="_bp0th8"><div class="_1miobth"><svg viewBox="0 0 24 24" role="presentation" aria-hidden="true" focusable="false" style="" fill- rule="evenodd"></path></svg></div></div></div><div class="_178faes"> <input type="text" autocomplete="off" class="_k3jto05" id="GeocompleteController-via-SearchBarV2- SearchBarV2" name="query" placeholder="Try “Costa Blanca”" value=""></div> </div> </div></div> locator: //input[@id=//label[.=‘Where’]/@for]
  • 12. LOCATOR STRATEGIES FOR WEB ELEMENTS DETECTING COMPONENT ▸ A component consists of related Web elements. Users view a component as a whole instead of individual elements • Examples are search result blocks, carousels ▸ A component is located as a whole instead of its individual elements
  • 13. LOCATOR STRATEGIES FOR WEB ELEMENTS COMPONENT <div class="_16nvkt52"><div class="_qgh1p4"> <button type="button" class="_6m75u2" aria-busy="false" data-veloute="explore-nav-card:/homes"> <div><div class="_112c092"><div class="_1thk0tsb"><div class="_e296pg" style="width: 96px; height: 72px;"><div class="_6ikqekk" style=""></div></div></div><div class="_ni9axhe"><div class="_13lgpze"><div class="_1ho874em"> <span class="_1t073h8">Homes</span> </div></div></div></div></div> </button> </div></div> Locator: .//button[.//span[.=‘Homes’]]
  • 14. LOCATOR STRATEGIES FOR WEB ELEMENTS COMPONENT
  • 15. LOCATOR STRATEGIES FOR WEB ELEMENTS COMPONENT Locator: .//div[@itemprop=itemListElement’][.//div[.=‘Penthouse Room Close to Big Ben’]]