SlideShare a Scribd company logo
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 (20)

PPTX
Appium solution
Nael Abd Eljawad
 
PDF
Android UI Testing with Appium
Luke Maung
 
PDF
Appium Interview Questions and Answers | Edureka
Edureka!
 
PPTX
Wheat - Mobile functional test automation
Sunny Tambi
 
PDF
What's New With Appium? From 1.0 to Now
Sauce Labs
 
PDF
Getting started with appium
Pratik Patel
 
PPT
Using Selenium to Test Native Apps (Wait, you can do that?)
Sauce Labs
 
PPTX
Mobile Automation with Appium
Manoj Kumar Kumar
 
PDF
Testing Native iOS Apps with Appium
Sauce Labs
 
PDF
Appium
Sveta Fedik
 
PPTX
Getting Started with Mobile Test Automation & Appium
Sauce Labs
 
PPTX
Appium meet up noida
Amit Rawat
 
PDF
Appium basics
Syam Sasi
 
PPSX
Cross platform test automation using Appium
Jatin Bhasin
 
PDF
Design First API's with RAML and SoapUI
Daniel Feist
 
PDF
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
PPTX
Appium - test automation for mobile apps
Aleksejs Trescalins
 
PDF
Mobile Test Automation - Appium
Maria Machlowska
 
PPTX
Appium overview
Abhishek Yadav
 
PDF
Mobile automation – should I use robotium or calabash or appium?
Zado Technologies
 
Appium solution
Nael Abd Eljawad
 
Android UI Testing with Appium
Luke Maung
 
Appium Interview Questions and Answers | Edureka
Edureka!
 
Wheat - Mobile functional test automation
Sunny Tambi
 
What's New With Appium? From 1.0 to Now
Sauce Labs
 
Getting started with appium
Pratik Patel
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Sauce Labs
 
Mobile Automation with Appium
Manoj Kumar Kumar
 
Testing Native iOS Apps with Appium
Sauce Labs
 
Appium
Sveta Fedik
 
Getting Started with Mobile Test Automation & Appium
Sauce Labs
 
Appium meet up noida
Amit Rawat
 
Appium basics
Syam Sasi
 
Cross platform test automation using Appium
Jatin Bhasin
 
Design First API's with RAML and SoapUI
Daniel Feist
 
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
Appium - test automation for mobile apps
Aleksejs Trescalins
 
Mobile Test Automation - Appium
Maria Machlowska
 
Appium overview
Abhishek Yadav
 
Mobile automation – should I use robotium or calabash or appium?
Zado Technologies
 

Viewers also liked (20)

PPTX
TechTalk: Everything You Need to Know about Appium & Selenium
Lizzy Guido (she/her)
 
PPTX
Mobile DevTest Dictionary
Perfecto by Perforce
 
PPT
Achieving a Winning Digital User Experience with Real World Testing
Perfecto by Perforce
 
PPTX
How to Test on the Right Mobile Platforms
Perfecto by Perforce
 
PPTX
TechTalk: Report Bugs Like a Boss
Lizzy Guido (she/her)
 
PPT
Qtp 8.0 basic
medsherb
 
PPTX
Selenium Testing
Shreshtt Bhatt
 
PDF
Ten reasons why now is the perfect time to get serious about the mobile web
Tijs Vrolix
 
PPTX
Webinar: Appium & Perfecto: A Perfect Match
Lizzy Guido (she/her)
 
PPTX
QTP Automation Testing Tutorial 2
Akash Tyagi
 
PPT
Qtp 80 Basics3561
Siddhartha Parida
 
PPTX
Qtp object repository
Bharath Sannadi
 
PDF
Hp perfecto webinar - UFT Mobile
Perfecto Mobile
 
PDF
10 reasons why now is the perfect time to get started with the mobile web
Tijs Vrolix
 
PDF
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Aspire Systems
 
PPTX
Testing Apps for Wearables
Perfecto by Perforce
 
PPTX
Selenium- A Software Testing Tool
Zeba Tahseen
 
PPTX
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Perfecto by Perforce
 
PDF
iOS9 Launch - Mobile Dev & Test Implications
Perfecto Mobile
 
PDF
7 Keys for Unattended Test AUtomation webinar deck
Perfecto Mobile
 
TechTalk: Everything You Need to Know about Appium & Selenium
Lizzy Guido (she/her)
 
Mobile DevTest Dictionary
Perfecto by Perforce
 
Achieving a Winning Digital User Experience with Real World Testing
Perfecto by Perforce
 
How to Test on the Right Mobile Platforms
Perfecto by Perforce
 
TechTalk: Report Bugs Like a Boss
Lizzy Guido (she/her)
 
Qtp 8.0 basic
medsherb
 
Selenium Testing
Shreshtt Bhatt
 
Ten reasons why now is the perfect time to get serious about the mobile web
Tijs Vrolix
 
Webinar: Appium & Perfecto: A Perfect Match
Lizzy Guido (she/her)
 
QTP Automation Testing Tutorial 2
Akash Tyagi
 
Qtp 80 Basics3561
Siddhartha Parida
 
Qtp object repository
Bharath Sannadi
 
Hp perfecto webinar - UFT Mobile
Perfecto Mobile
 
10 reasons why now is the perfect time to get started with the mobile web
Tijs Vrolix
 
Test Automation Tool comparison – HP UFT/QTP vs. Selenium
Aspire Systems
 
Testing Apps for Wearables
Perfecto by Perforce
 
Selenium- A Software Testing Tool
Zeba Tahseen
 
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Perfecto by Perforce
 
iOS9 Launch - Mobile Dev & Test Implications
Perfecto Mobile
 
7 Keys for Unattended Test AUtomation webinar deck
Perfecto Mobile
 
Ad

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

PPTX
TechTalk: Advanced Practices for Visual Test Automation
Lizzy Guido (she/her)
 
ODP
FluentSelenium Presentation Code Camp09
Pyxis Technologies
 
PPTX
Intro to appcelerator
Mohab El-Shishtawy
 
PDF
Using XPath in Selenium - All you need to know.pdf
flufftailshop
 
PPTX
Espresso workshop
Ketan Soni
 
PDF
Session on Selenium Powertools by Unmesh Gundecha
Agile Testing Alliance
 
PPTX
CS02A - Interacting with applications.pptx
Anand722237
 
PPTX
Project_Goibibo information technology automation testing.pptx
skhushi9980
 
PDF
uMobile Development Strategies
Jasig uPortal Project
 
PPTX
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Pankaj Dubey
 
PDF
UiPath Veterans RPA Studio track program - Session 3: Introduction to Ui Auto...
DianaGray10
 
PPT
Ranorex - Highlights
Cassian Raja
 
PDF
Acceptance testing plone sites and add ons with robot framework and selenium
Asko Soukka
 
PPTX
SPTechCon - Share point and jquery essentials
Mark Rackley
 
PPTX
Developing Lightning Components for Communities.pptx
Dmitry Vinnik
 
PDF
uMobile Preconference Seminar
Jennifer Bourey
 
ODP
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connections Developers
 
ODP
JMP103 : Extending Your App Arsenal With OpenSocial
Ryan Baxter
 
PPT
PowerPoint
Videoguy
 
PPTX
iOS app dev Training - Session1
Hussain Behestee
 
TechTalk: Advanced Practices for Visual Test Automation
Lizzy Guido (she/her)
 
FluentSelenium Presentation Code Camp09
Pyxis Technologies
 
Intro to appcelerator
Mohab El-Shishtawy
 
Using XPath in Selenium - All you need to know.pdf
flufftailshop
 
Espresso workshop
Ketan Soni
 
Session on Selenium Powertools by Unmesh Gundecha
Agile Testing Alliance
 
CS02A - Interacting with applications.pptx
Anand722237
 
Project_Goibibo information technology automation testing.pptx
skhushi9980
 
uMobile Development Strategies
Jasig uPortal Project
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Pankaj Dubey
 
UiPath Veterans RPA Studio track program - Session 3: Introduction to Ui Auto...
DianaGray10
 
Ranorex - Highlights
Cassian Raja
 
Acceptance testing plone sites and add ons with robot framework and selenium
Asko Soukka
 
SPTechCon - Share point and jquery essentials
Mark Rackley
 
Developing Lightning Components for Communities.pptx
Dmitry Vinnik
 
uMobile Preconference Seminar
Jennifer Bourey
 
IBM Connect 2014 - JMP103: Extending Your Application Arsenal With OpenSocial
IBM Connections Developers
 
JMP103 : Extending Your App Arsenal With OpenSocial
Ryan Baxter
 
PowerPoint
Videoguy
 
iOS app dev Training - Session1
Hussain Behestee
 
Ad

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

PPTX
Appium & Selenium Alone vs Appium & Selenium with Perfecto
Lizzy Guido (she/her)
 
PPTX
What's New with Perfecto? - Mid-Year Edition
Lizzy Guido (she/her)
 
PPT
Mobile Monitoring Best Practices
Lizzy Guido (she/her)
 
PPTX
What's New with Perfecto? - June 2017
Lizzy Guido (she/her)
 
PPTX
What's New with Perfecto? - May 2017
Lizzy Guido (she/her)
 
PPTX
How To Sell Into Insurance with Perfecto
Lizzy Guido (she/her)
 
PPTX
How to Add Perfecto to Your CI
Lizzy Guido (she/her)
 
PPTX
What's New with Perfecto? - April 2017
Lizzy Guido (she/her)
 
PPTX
TechTalk: Wind Tunnel, Personas, and Testing Real UX
Lizzy Guido (she/her)
 
PPTX
What's New? - March 2017
Lizzy Guido (she/her)
 
PPTX
TechTalk: What's New with Perfecto?
Lizzy Guido (she/her)
 
PPTX
Appium vs Appium with Perfecto
Lizzy Guido (she/her)
 
PPTX
What's New? - February 2017
Lizzy Guido (she/her)
 
PPTX
Intro to Automation Using Perfecto's CQ Lab
Lizzy Guido (she/her)
 
PPTX
TechTalk: Get to Know Perfecto
Lizzy Guido (she/her)
 
PPTX
Persona Testing - Deep Dive
Lizzy Guido (she/her)
 
PPTX
How Digital Changed the Game... and how to cross platform test for it
Lizzy Guido (she/her)
 
PPTX
TechTalk: Getting to Know Perfecto
Lizzy Guido (she/her)
 
PPTX
Webinar: How to Size a Lab
Lizzy Guido (she/her)
 
PPTX
Automating things you didn't know you could automate
Lizzy Guido (she/her)
 
Appium & Selenium Alone vs Appium & Selenium with Perfecto
Lizzy Guido (she/her)
 
What's New with Perfecto? - Mid-Year Edition
Lizzy Guido (she/her)
 
Mobile Monitoring Best Practices
Lizzy Guido (she/her)
 
What's New with Perfecto? - June 2017
Lizzy Guido (she/her)
 
What's New with Perfecto? - May 2017
Lizzy Guido (she/her)
 
How To Sell Into Insurance with Perfecto
Lizzy Guido (she/her)
 
How to Add Perfecto to Your CI
Lizzy Guido (she/her)
 
What's New with Perfecto? - April 2017
Lizzy Guido (she/her)
 
TechTalk: Wind Tunnel, Personas, and Testing Real UX
Lizzy Guido (she/her)
 
What's New? - March 2017
Lizzy Guido (she/her)
 
TechTalk: What's New with Perfecto?
Lizzy Guido (she/her)
 
Appium vs Appium with Perfecto
Lizzy Guido (she/her)
 
What's New? - February 2017
Lizzy Guido (she/her)
 
Intro to Automation Using Perfecto's CQ Lab
Lizzy Guido (she/her)
 
TechTalk: Get to Know Perfecto
Lizzy Guido (she/her)
 
Persona Testing - Deep Dive
Lizzy Guido (she/her)
 
How Digital Changed the Game... and how to cross platform test for it
Lizzy Guido (she/her)
 
TechTalk: Getting to Know Perfecto
Lizzy Guido (she/her)
 
Webinar: How to Size a Lab
Lizzy Guido (she/her)
 
Automating things you didn't know you could automate
Lizzy Guido (she/her)
 

Recently uploaded (20)

PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PPTX
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
PDF
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
PDF
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
PPTX
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
PDF
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PPTX
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
Upskill to Agentic Automation 2025 - Kickoff Meeting
DianaGray10
 
How Current Advanced Cyber Threats Transform Business Operation
Eryk Budi Pratama
 
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
Rethinking Security Operations - Modern SOC.pdf
Haris Chughtai
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
Productivity Management Software | Workstatus
Lovely Baghel
 

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: [email protected]
  • 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: [email protected]

Editor's Notes

  • #6: 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
  • #8: 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
  • #9: 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.)
  • #10: The following slide will describe how to use the Object Spy.
  • #11: 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.
  • #12: 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.
  • #13: Example: Android Device B of A Application Sign In Button (Click) Object Locator – provides a more robust xpath instead of just location based
  • #14: 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
  • #15: 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.
  • #16: 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.
  • #18: 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.]
  • #19: 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.
  • #20: 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.
  • #21: 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