SlideShare a Scribd company logo
1 of 22
Object Spy, Visual Analysis and
XML/Xpath
Intro and Demo for Partners
David Broerman
Partner Enablement Manager
Phone: 727. 225.2826 / Email:
davidb@perfectomobile.com
Agenda
• Basics around XML and Xpath
• What are XML and Xpath?
• Working with XML and Xpath
• Object Analysis and the Perfecto Object Spy
• Visual Analysis
• Quick Demo
• Open Perfecto Automation
• Discuss Object Spy , Visual and Xpath
• Open existing Perfecto Lab Selenium Project in Eclipse
• Discuss Object Spy , Visual and Xpath
What are XML and Xpath?
• XML
• EXtensible Markup Language
• XML enables you to create data that can read by any application on any
platform
• Native Object analysis relies on XML
• The Object Tree is an XML document
• Xpath (XML Path Language)
• XPath is the query language for XML documents
• Describes a way to locate and process items in XML documents
• In automation, Xpath allows us to identify the object/objects
Importance of Understanding XML and XPath
4
• Native Object analysis relies on XML
• Retrieves the XML document and analyzes it
• However, it this is not enough to identify the object using its location in the
object tree. This approach is fragile.
• It is necessary to use specific XPath expressions to uniquely identify the
object.
• This will enable your object to be found across multiple platforms and
devices.
Native Objects Analysis
5
• The Object Tree is an XML document
• The way to find elements inside XML is through XPath
• To properly work with Objects, a good grasp of XML/XPath is needed.
The Perfecto Approach for Mobile
Objects
Native Object Analysis
and
Visual Object Analysis
=
HYBRID APPROACH!
Best Practice: Use Native Object
Analysis for Navigating and
Visual/OCR for Validation.
Pros
Cons
The Object Spy enables working with objects
• The Object Spy accesses the XML of the application
• Identifies the element and writes an XPath Expression.
• May need to export the XML into Firebug/FirePath.
• Inserts the expression back into the Object Spy.
• Applies the required action:
• Click – click on the element
• Set – an edit field with a value
• Info – to retrieve an element to receive its properties
• Find – find an element
Website & Apps – Object Trees/Identifying Objects
• Web Objects
• DOM
• Same Tree (PM or Appium
Framework)
• Native App Objects
• PM or Appium framework
• Appium -Separate naming
for Android and iOS
• Perfecto – Script Once
• Hybrid Application
• PM automation framework
• Mix of Native and DOM
objects
DOM Perfecto
Mobile
Appium
Working with the Object Spy
Selected Automation Function and Parameter fields
Object
XPath
Object TreePreview Panel
Search
and
Export
Filter displayed Objects
Object
Properties
Automation
functions
associated
with the
selected
object type
Adding Commands from the Object
Spy
Working with Firebug and FirePath
11
Object Spy: Object Locator
Available – Release 8.6
• Object
Locator is now
available for
Native, Web and
Hybrid apps.
• Easily generate
accurate XPath
identifiers from
within the
Perfecto Object
Spy
• Don’t have to
export to XML
and use tools
such as FireBug
and FirePath.
Visual Analysis
• Visual analysis is an alternative way of interacting with a device.
• Its’ source is the screenshot taken from the device (what the user sees).
• Perfecto can analyze the screenshot looking for either text or
images, with text being the recommended option.
Best Practice: Use Native Object
Analysis for Navigating and Visual for Validation.
Visual - Available Commands
• Select - Clicks on the image/text
• Find – Finds an image/text for visual
relationship
• Check – A Checkpoint that validates the
text/image appears on the screen
• (Sync is same command , Sync has a default
timeout of 60 seconds and check does not)
• Button – Clicks a Button
• Edit - Sets a value inside an input field
10/12/2016 14© 2015, Perfecto Mobile Ltd. All Rights Reserved.
Example - Coding Visual Analysis –
Java
• Visual Analysis –
Perfecto
Proprietary
command
executed using
RemoteWebDriver
• Use the
executeScript
method
• The script
parameter
contains the
command name,
in the following
format:
mobile:command
:subcommand.10/12/2016 15© 2015, Perfecto Mobile Ltd. All Rights Reserved.
Map<String, Object> params3 = new HashMap<>();
// Check for the text that indicates that the sign in
was successful
params3.put("content", "Welcome back John");
// allow up-to 30 seconds for the page to display
params3.put("timeout", "30");
resultString = (String)
driver.executeScript("mobile:checkpoint:text",
params3);
if (!resultString.equalsIgnoreCase("true")) {
System.out.println("'Welcome back John' text not
found");
}
Did You Know?
• When talking with users of the Perfecto Solution
• Approximately 90% of testing defects are found using Visual
Validation!
• Mobile is different as we want to understand the UX
• Need to see what the user sees
• An object on the screen may be found, but it may be hidden
behind something else (need visual validation).
XPath Examples
Example of Power of Xpath with Objects
18
Let's say that we want to work on a username field.
Remember:
 The default path generated by the Object Spy refers to its location; its placement on the
page.
 The placement of that object can change, or be slightly different in another platform
(i.e. tablet vs. smartphone).
 So, it's important to refer to it by its logical function instead of an arbitrary placement on
the page.
XPath will allow this to be specified: //[@username]
 This expression explicitly refers to the input field called 'username'.
Advantages:
 It is easy to read.
 It is likely to work well with minimal maintenance.
 It is likely to be identical across devices and platforms.
XPath Expression Syntax
19
Expression Description
nodename Selects all nodes with the name "nodename"
// Selects nodes in the document from the current node that match
the selection no matter where they are
//vehicle Selects all vehicle elements no matter where they are in the
document
//@make Selects all attributes named make
//*[@make="Toyota"] Select all attributes named make with value of Toyota
//vehicle[@*] Selects all vehicle elements which have any attribute
//*[text()=’Corolla’] Select all objects with the text Corolla
//vehicle[2] Select the second vehicle element
Demo
• Open Perfecto Automation and also Open existing Perfecto Lab Selenium
Project in Eclipse
• Discuss Object Spy , Visual Analysis and Xpath
Resources
• Sample script and Demo Apps
• https://community.perfectomobile.com/series/25427/posts/1064930
• Working with Object Spy and XPath
• https://community.perfectomobile.com/posts/914140-web-objects
• XPath Tutorial
• http://www.w3schools.com/XPath/
• XML Tutorial
• http://www.w3schools.com/xml/
Thank You
David Broerman
Partner Enablement Manager
Phone: 727. 225.2826 / Email:
davidb@perfectomobile.com

More Related Content

What's hot

Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
Sauce Labs
 
Testing Native iOS Apps with Appium
Testing Native iOS Apps with AppiumTesting Native iOS Apps with Appium
Testing Native iOS Apps with Appium
Sauce Labs
 

What's hot (20)

Appium solution
Appium solutionAppium solution
Appium solution
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
Appium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaAppium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | Edureka
 
Wheat - Mobile functional test automation
Wheat - Mobile functional test automationWheat - Mobile functional test automation
Wheat - Mobile functional test automation
 
What's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to NowWhat's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to Now
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
 
Testing Native iOS Apps with Appium
Testing Native iOS Apps with AppiumTesting Native iOS Apps with Appium
Testing Native iOS Apps with Appium
 
Appium
AppiumAppium
Appium
 
Getting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & AppiumGetting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & Appium
 
Appium meet up noida
Appium meet up noidaAppium meet up noida
Appium meet up noida
 
Appium basics
Appium basicsAppium basics
Appium basics
 
Cross platform test automation using Appium
Cross platform test automation using AppiumCross platform test automation using Appium
Cross platform test automation using Appium
 
Design First API's with RAML and SoapUI
Design First API's with RAML and SoapUIDesign First API's with RAML and SoapUI
Design First API's with RAML and SoapUI
 
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
 
Appium - test automation for mobile apps
Appium - test automation for mobile appsAppium - test automation for mobile apps
Appium - test automation for mobile apps
 
Mobile Test Automation - Appium
Mobile Test Automation - AppiumMobile Test Automation - Appium
Mobile Test Automation - Appium
 
Appium overview
Appium overviewAppium overview
Appium overview
 
Mobile automation – should I use robotium or calabash or appium?
Mobile automation – should I use robotium or calabash or appium?Mobile automation – should I use robotium or calabash or appium?
Mobile automation – should I use robotium or calabash or appium?
 

Viewers also liked

Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basic
medsherb
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
Perfecto Mobile
 

Viewers also liked (20)

TechTalk: Everything You Need to Know about Appium & Selenium
TechTalk: Everything You Need to Know about Appium & SeleniumTechTalk: Everything You Need to Know about Appium & Selenium
TechTalk: Everything You Need to Know about Appium & Selenium
 
Mobile DevTest Dictionary
Mobile DevTest DictionaryMobile DevTest Dictionary
Mobile DevTest Dictionary
 
Achieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World TestingAchieving a Winning Digital User Experience with Real World Testing
Achieving a Winning Digital User Experience with Real World Testing
 
How to Test on the Right Mobile Platforms
How to Test on the Right Mobile PlatformsHow to Test on the Right Mobile Platforms
How to Test on the Right Mobile Platforms
 
TechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a BossTechTalk: Report Bugs Like a Boss
TechTalk: Report Bugs Like a Boss
 
Qtp 8.0 basic
Qtp 8.0 basicQtp 8.0 basic
Qtp 8.0 basic
 
Qtp day 1
Qtp day 1Qtp day 1
Qtp day 1
 
Selenium Testing
Selenium Testing Selenium Testing
Selenium Testing
 
Ten reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile webTen reasons why now is the perfect time to get serious about the mobile web
Ten reasons why now is the perfect time to get serious about the mobile web
 
Webinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect MatchWebinar: Appium & Perfecto: A Perfect Match
Webinar: Appium & Perfecto: A Perfect Match
 
QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2QTP Automation Testing Tutorial 2
QTP Automation Testing Tutorial 2
 
Qtp 80 Basics3561
Qtp 80 Basics3561Qtp 80 Basics3561
Qtp 80 Basics3561
 
Qtp object repository
Qtp object repositoryQtp object repository
Qtp object repository
 
Hp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
 
10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web10 reasons why now is the perfect time to get started with the mobile web
10 reasons why now is the perfect time to get started with the mobile web
 
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Test Automation Tool comparison –  HP UFT/QTP vs. SeleniumTest Automation Tool comparison –  HP UFT/QTP vs. Selenium
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
 
Testing Apps for Wearables
Testing Apps for WearablesTesting Apps for Wearables
Testing Apps for Wearables
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesLaunch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
 
iOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test ImplicationsiOS9 Launch - Mobile Dev & Test Implications
iOS9 Launch - Mobile Dev & Test Implications
 

Similar to TechTalk: Taking the Mystery Out of Object ID Automation

CS02A - Interacting with applications.pptx
CS02A - Interacting with applications.pptxCS02A - Interacting with applications.pptx
CS02A - Interacting with applications.pptx
Anand722237
 
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
skhushi9980
 
Ranorex - Highlights
Ranorex - HighlightsRanorex - Highlights
Ranorex - Highlights
Cassian Raja
 
SPTechCon - Share point and jquery essentials
SPTechCon - Share point and jquery essentialsSPTechCon - Share point and jquery essentials
SPTechCon - Share point and jquery essentials
Mark Rackley
 
PowerPoint
PowerPointPowerPoint
PowerPoint
Videoguy
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
Hussain Behestee
 
Interview qutions
Interview qutionsInterview qutions
Interview qutions
satyaragha
 

Similar to TechTalk: Taking the Mystery Out of Object ID Automation (20)

TechTalk: Advanced Practices for Visual Test Automation
TechTalk: Advanced Practices for Visual Test AutomationTechTalk: Advanced Practices for Visual Test Automation
TechTalk: Advanced Practices for Visual Test Automation
 
FluentSelenium Presentation Code Camp09
FluentSelenium Presentation Code Camp09FluentSelenium Presentation Code Camp09
FluentSelenium Presentation Code Camp09
 
Intro to appcelerator
Intro to appceleratorIntro to appcelerator
Intro to appcelerator
 
Espresso workshop
Espresso workshopEspresso workshop
Espresso workshop
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
CS02A - Interacting with applications.pptx
CS02A - Interacting with applications.pptxCS02A - Interacting with applications.pptx
CS02A - Interacting with applications.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
 
uMobile Development Strategies
uMobile Development StrategiesuMobile Development Strategies
uMobile Development Strategies
 
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
 
Ranorex - Highlights
Ranorex - HighlightsRanorex - Highlights
Ranorex - Highlights
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
SPTechCon - Share point and jquery essentials
SPTechCon - Share point and jquery essentialsSPTechCon - Share point and jquery essentials
SPTechCon - Share point and jquery essentials
 
Developing Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDeveloping Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptx
 
uMobile Preconference Seminar
uMobile Preconference SeminaruMobile Preconference Seminar
uMobile Preconference Seminar
 
JMP103 : Extending Your App Arsenal With OpenSocial
JMP103 : Extending Your App Arsenal With OpenSocialJMP103 : Extending Your App Arsenal With OpenSocial
JMP103 : Extending Your App Arsenal With OpenSocial
 
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocialIBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
 
PowerPoint
PowerPointPowerPoint
PowerPoint
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
 
Interview qutions
Interview qutionsInterview qutions
Interview qutions
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 

More from Lizzy Guido (she/her)

More from Lizzy Guido (she/her) (20)

Appium & Selenium Alone vs Appium & Selenium with Perfecto
Appium & Selenium Alone vs Appium & Selenium with PerfectoAppium & Selenium Alone vs Appium & Selenium with Perfecto
Appium & Selenium Alone vs Appium & Selenium with Perfecto
 
What's New with Perfecto? - Mid-Year Edition
What's New with Perfecto? - Mid-Year EditionWhat's New with Perfecto? - Mid-Year Edition
What's New with Perfecto? - Mid-Year Edition
 
Mobile Monitoring Best Practices
Mobile Monitoring Best PracticesMobile Monitoring Best Practices
Mobile Monitoring Best Practices
 
What's New with Perfecto? - June 2017
What's New with Perfecto? - June 2017What's New with Perfecto? - June 2017
What's New with Perfecto? - June 2017
 
What's New with Perfecto? - May 2017
What's New with Perfecto? - May 2017What's New with Perfecto? - May 2017
What's New with Perfecto? - May 2017
 
How To Sell Into Insurance with Perfecto
How To Sell Into Insurance with PerfectoHow To Sell Into Insurance with Perfecto
How To Sell Into Insurance with Perfecto
 
How to Add Perfecto to Your CI
How to Add Perfecto to Your CIHow to Add Perfecto to Your CI
How to Add Perfecto to Your CI
 
What's New with Perfecto? - April 2017
What's New with Perfecto? - April 2017What's New with Perfecto? - April 2017
What's New with Perfecto? - April 2017
 
TechTalk: Wind Tunnel, Personas, and Testing Real UX
TechTalk: Wind Tunnel, Personas, and Testing Real UXTechTalk: Wind Tunnel, Personas, and Testing Real UX
TechTalk: Wind Tunnel, Personas, and Testing Real UX
 
What's New? - March 2017
What's New? - March 2017What's New? - March 2017
What's New? - March 2017
 
TechTalk: What's New with Perfecto?
TechTalk: What's New with Perfecto?TechTalk: What's New with Perfecto?
TechTalk: What's New with Perfecto?
 
Appium vs Appium with Perfecto
Appium vs Appium with PerfectoAppium vs Appium with Perfecto
Appium vs Appium with Perfecto
 
What's New? - February 2017
What's New? - February 2017What's New? - February 2017
What's New? - February 2017
 
Intro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ LabIntro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ Lab
 
TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto TechTalk: Get to Know Perfecto
TechTalk: Get to Know Perfecto
 
Persona Testing - Deep Dive
Persona Testing - Deep DivePersona Testing - Deep Dive
Persona Testing - Deep Dive
 
How Digital Changed the Game... and how to cross platform test for it
How Digital Changed the Game... and how to cross platform test for itHow Digital Changed the Game... and how to cross platform test for it
How Digital Changed the Game... and how to cross platform test for it
 
TechTalk: Getting to Know Perfecto
TechTalk: Getting to Know PerfectoTechTalk: Getting to Know Perfecto
TechTalk: Getting to Know Perfecto
 
Webinar: How to Size a Lab
Webinar: How to Size a LabWebinar: How to Size a Lab
Webinar: How to Size a Lab
 
Automating things you didn't know you could automate
Automating things you didn't know you could automateAutomating things you didn't know you could automate
Automating things you didn't know you could automate
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

TechTalk: Taking the Mystery Out of Object ID Automation

  • 1. Object Spy, Visual Analysis and XML/Xpath Intro and Demo for Partners David Broerman Partner Enablement Manager Phone: 727. 225.2826 / Email: davidb@perfectomobile.com
  • 2. Agenda • Basics around XML and Xpath • What are XML and Xpath? • Working with XML and Xpath • Object Analysis and the Perfecto Object Spy • Visual Analysis • Quick Demo • Open Perfecto Automation • Discuss Object Spy , Visual and Xpath • Open existing Perfecto Lab Selenium Project in Eclipse • Discuss Object Spy , Visual and Xpath
  • 3. What are XML and Xpath? • XML • EXtensible Markup Language • XML enables you to create data that can read by any application on any platform • Native Object analysis relies on XML • The Object Tree is an XML document • Xpath (XML Path Language) • XPath is the query language for XML documents • Describes a way to locate and process items in XML documents • In automation, Xpath allows us to identify the object/objects
  • 4. Importance of Understanding XML and XPath 4 • Native Object analysis relies on XML • Retrieves the XML document and analyzes it • However, it this is not enough to identify the object using its location in the object tree. This approach is fragile. • It is necessary to use specific XPath expressions to uniquely identify the object. • This will enable your object to be found across multiple platforms and devices.
  • 5. Native Objects Analysis 5 • The Object Tree is an XML document • The way to find elements inside XML is through XPath • To properly work with Objects, a good grasp of XML/XPath is needed.
  • 6. The Perfecto Approach for Mobile Objects Native Object Analysis and Visual Object Analysis = HYBRID APPROACH! Best Practice: Use Native Object Analysis for Navigating and Visual/OCR for Validation. Pros Cons
  • 7. The Object Spy enables working with objects • The Object Spy accesses the XML of the application • Identifies the element and writes an XPath Expression. • May need to export the XML into Firebug/FirePath. • Inserts the expression back into the Object Spy. • Applies the required action: • Click – click on the element • Set – an edit field with a value • Info – to retrieve an element to receive its properties • Find – find an element
  • 8. Website & Apps – Object Trees/Identifying Objects • Web Objects • DOM • Same Tree (PM or Appium Framework) • Native App Objects • PM or Appium framework • Appium -Separate naming for Android and iOS • Perfecto – Script Once • Hybrid Application • PM automation framework • Mix of Native and DOM objects DOM Perfecto Mobile Appium
  • 9. Working with the Object Spy Selected Automation Function and Parameter fields Object XPath Object TreePreview Panel Search and Export Filter displayed Objects Object Properties Automation functions associated with the selected object type
  • 10. Adding Commands from the Object Spy
  • 11. Working with Firebug and FirePath 11
  • 12. Object Spy: Object Locator Available – Release 8.6 • Object Locator is now available for Native, Web and Hybrid apps. • Easily generate accurate XPath identifiers from within the Perfecto Object Spy • Don’t have to export to XML and use tools such as FireBug and FirePath.
  • 13. Visual Analysis • Visual analysis is an alternative way of interacting with a device. • Its’ source is the screenshot taken from the device (what the user sees). • Perfecto can analyze the screenshot looking for either text or images, with text being the recommended option. Best Practice: Use Native Object Analysis for Navigating and Visual for Validation.
  • 14. Visual - Available Commands • Select - Clicks on the image/text • Find – Finds an image/text for visual relationship • Check – A Checkpoint that validates the text/image appears on the screen • (Sync is same command , Sync has a default timeout of 60 seconds and check does not) • Button – Clicks a Button • Edit - Sets a value inside an input field 10/12/2016 14© 2015, Perfecto Mobile Ltd. All Rights Reserved.
  • 15. Example - Coding Visual Analysis – Java • Visual Analysis – Perfecto Proprietary command executed using RemoteWebDriver • Use the executeScript method • The script parameter contains the command name, in the following format: mobile:command :subcommand.10/12/2016 15© 2015, Perfecto Mobile Ltd. All Rights Reserved. Map<String, Object> params3 = new HashMap<>(); // Check for the text that indicates that the sign in was successful params3.put("content", "Welcome back John"); // allow up-to 30 seconds for the page to display params3.put("timeout", "30"); resultString = (String) driver.executeScript("mobile:checkpoint:text", params3); if (!resultString.equalsIgnoreCase("true")) { System.out.println("'Welcome back John' text not found"); }
  • 16. Did You Know? • When talking with users of the Perfecto Solution • Approximately 90% of testing defects are found using Visual Validation! • Mobile is different as we want to understand the UX • Need to see what the user sees • An object on the screen may be found, but it may be hidden behind something else (need visual validation).
  • 18. Example of Power of Xpath with Objects 18 Let's say that we want to work on a username field. Remember:  The default path generated by the Object Spy refers to its location; its placement on the page.  The placement of that object can change, or be slightly different in another platform (i.e. tablet vs. smartphone).  So, it's important to refer to it by its logical function instead of an arbitrary placement on the page. XPath will allow this to be specified: //[@username]  This expression explicitly refers to the input field called 'username'. Advantages:  It is easy to read.  It is likely to work well with minimal maintenance.  It is likely to be identical across devices and platforms.
  • 19. XPath Expression Syntax 19 Expression Description nodename Selects all nodes with the name "nodename" // Selects nodes in the document from the current node that match the selection no matter where they are //vehicle Selects all vehicle elements no matter where they are in the document //@make Selects all attributes named make //*[@make="Toyota"] Select all attributes named make with value of Toyota //vehicle[@*] Selects all vehicle elements which have any attribute //*[text()=’Corolla’] Select all objects with the text Corolla //vehicle[2] Select the second vehicle element
  • 20. Demo • Open Perfecto Automation and also Open existing Perfecto Lab Selenium Project in Eclipse • Discuss Object Spy , Visual Analysis and Xpath
  • 21. Resources • Sample script and Demo Apps • https://community.perfectomobile.com/series/25427/posts/1064930 • Working with Object Spy and XPath • https://community.perfectomobile.com/posts/914140-web-objects • XPath Tutorial • http://www.w3schools.com/XPath/ • XML Tutorial • http://www.w3schools.com/xml/
  • 22. Thank You David Broerman Partner Enablement Manager Phone: 727. 225.2826 / Email: davidb@perfectomobile.com

Editor's Notes

  1. How it works: -Receives Object tree (XML) from App or Website Main Features: -All objects are exposed by Perfecto -Objects can be clicked, set or queried
  2. When the Object Spy accesses the XML (shows the Object Tree), These are the steps to work with objects, we will now drill down and show you step-by-step
  3. Identifying objects on the different types of mobile applications can be done in many ways. We will focus on using the following frameworks, according to Perfecto Mobile best practices: the DOM objects for testing web applications Appium framework for testing Native applications, and Perfecto Mobile framework for testing hybrid applications This Framework selection is for what Trees you see (Perfecto or Appium) (Remember, since in these examples we are working on a native application, we will be setting our Automation Framework and Driver to Appium. To do this, go to: More > Settings > Automation Tab > Framework tab) Using the Object Spy and picking an Automation Framework enables us to find, view properties, and perform interactions on the application using objects (such as a clicking on something on the device screen, selecting an image or text element, and setting text in an edit field). (A little more about identifying objects: Application User Interfaces are drawn to the screen based on a definition (that’s provided by the application) of how and where to draw the different UI Elements. The definition is a hierarchy of available UI Elements that can be described as an Object Tree. The Object Tree for Web applications uses a standard set of UI Element types to describe how to draw the User Interface. This is the DOM tree and the UI Elements in that standard can be used to describe any website or web application.) The Perfecto Mobile and Appium Frameworks: In the world of mobile applications, it is not as simple. Apple has its own proprietary set of UI Elements and this is different from the proprietary set used by Android. Perfecto Mobile created a framework that allows us to translate the competing UI Elements of the different application UI sets into a “common” set of UI Elements and describe the UI structure of an application using these generic UI Elements (Script Once). This is the Perfecto Mobile framework Object Tree. Appium, that we will be using in the latter part of the course to test native apps, references the UI Elements using the names provided by the proprietary description files. This is the Appium framework Object Tree. The Perfecto Mobile framework identifies the objects in the application with the same standard. This means that the object tree representation of the elements will be the same on both iOS and Android applications. The Appium framework uses two different object tree representations – UI Automator for Android and UI Automation for iOS. This means that when we develop our automation test, according to this mode of work, we will need to create two separate tests (one for Android and another for iOS). (For advanced users, the Perfecto Mobile framework supports identification of the objects either with the application classes or based on a translated generic set of classes. This enables using the same objects for both Android and iOS applications, also referred to as ScriptOnce. This will be covered in later modules.) The framework we choose to work with will determine the object tree representation, in XML format, that we see and work with when using the Perfecto Mobile Object Spy. (For beginner users, each object is refined by a set of attributes that define what is actually displayed. For example, the text attribute defines the text to display.)
  4. The following slide will describe how to use the Object Spy.
  5. Adding commands to the Automation script Click on the object in the preview panel Replace the default XPath with the one you have created Edit any necessary parameter field values Click Add to add the function to your script Optional: enable Execute on Add in the Object Spy to keep the Object Spy window open for additional functions (refresh the Object Spy preview panel to see the updated device screen) Recap We saw the object spy and did the full loop, starting in the mobile application, using the object spy to export the XML, writing the Xpath expression and then copying it back to the object spy. Once the correct expression was in the Spy, we selected the appropriate command, and with “execute on add” we are ready for the next step in the script. This flow is identical for mobile applications and websites and repeats whenever we want to work with objects.
  6. Step 2: Reading the XML document Open Firebug (top right of the Firefox browser menu bar) Inspect the element you want to work with by clicking on the Firebug inspector and then on the object in the page The object in the page and the location of it in the tree will be highlighted. Also, a default XPath will be automatically provided. Read the XML, understand what makes the element unique and write an XPath that will be able to find it (more on writing XPath expressions later on) Note: More on how to write XPath expressions will be covered later.
  7. Example: Android Device B of A Application Sign In Button (Click) Object Locator – provides a more robust xpath instead of just location based
  8. Analyzing a screenshot is slower and less reliable than object analysis, it exists as an addition to objects which is the main way to work. Its use is limited, but when it is needed it provides an excellent solution. Visual analysis is a Perfecto extension to RWD & Appium, providing a comprehensive solution that enables automating all test cases. The main uses for visual analysis are: In cases where object analysis does not work When there’s a need to validate what the user sees on a certain page
  9. There are 5 commands available to use with visual analysis. Exactly the same buttons for both Image and Text. All commands can receive a timeout to which is useful e.g. when a new page is loading. Can work with either text or an image with text being the preferred option. Text is easier to use, works seamlessly across multiple devices and requires the least maintenance.
  10. Since visual analysis is a Perfecto command, we use the executeScript method to run it. The commands require the needle to be provided (in this case the text “welcome back John”) and any additional parameters (in this case we set a timeout of 30 seconds, the system will search for the needle continually for 30 seconds) The returned true/false result can then be handled by the code.
  11. The following slides contain expressions written for various objects in the PM demo applications. Go through the expressions, emphasizing WHAT the expression is saying in plain English, and WHY it is saying it. The sample script MobileObjectsSample.java runs on the same demo applications, you can run it and show the expressions live with the class. [Trainer Notes: download the sample test “MobileObjectsSample.java” here https://community.perfectomobile.com/groups/30292/posts/1046689-sample-script-mobile-objects-sample add it to your project workspace run the test on an iOS and an Android device The next slides describe specific XPath expressions, used in the sample, in more detail.]
  12. The elements inside an application or website have a logical meaning a “login” button or “my account” link are not just the third or fourth element, they also have a specific purpose inside the application. Identifying these elements according to what they are, and not just according to where they are will result in a script that is much more robust, readable and valid for multiple devices and platforms. For example, the login button will always stay the login button, another element may be added before it changing the where but the what will remain the same.
  13. XPath allows us to specify: "Give me an element named vehicle that has an attribute with a value Toyota". XPath enables powerful and complex queries quickly and easily. Below is a list of the most common XPath syntax you will need to understand.
  14. Notes: Let’s review a sample test. Use Eclipse Project Named TrainingProjectExample RemoteWebDriverTest.java – run as java test Credentials in code: To run the sample remember to add your credentials and Lab URL String host = “myLab.perfectomobile.com"; capabilities.setCapability("user", “myUser"); capabilities.setCapability("password", “MyPassword"); Selenium and Perfecto Tree Uses BB&T U application – tried to login with username, password and validates error message for unsuccessful login Also opens device browser, goes to perfecto sample page, logs in and validates successful login