SlideShare a Scribd company logo
www.luxoft.com
Desktop Application Automation:
.NET Developer’s perspective
Ivan Danilov
www.luxoft.com
Automation definition and goals
• Microsoft UI Automation (UIA) is an application programming interface (API) that allows one to
access, identify, and manipulate the user interface (UI) elements of another application
[Wikipedia]
• Application testing
• Accessibility scenarios
www.luxoft.com
Availability
• Available since Windows Vista / Windows Server 2008
• Part of Windows 7 and above right after OS install
• Automates Win32, WinForms, WPF, UWP and other applications
• Ability to automate depends on UIA support that can be implemented for any UI in theory
• Frameworks and technologies listed above have UIA support out of the box
www.luxoft.com
UIA terminology
• Server – application that is being automated
• Client – automation driver, e.g. automated UI test
• AutomationElement – basic building block; every piece of UI that is exposed to automation is
represented with AutomationElement. They are contained in tree structure with desktop as the
root
• There’s no one-to-one relationship between automation elements and controls, but often it is the
case
• Control Patterns support the methods, properties, events, and relationships needed to define a
discrete piece of functionality available in a control
www.luxoft.com
History and UIA versions
• UIA is a successor to Microsoft Active Accessibility (MSAA)
• MSAA functionality is preserved in UIA in form of LegacyIAccessible pattern
• UIAv2
• Initial implementation
• Set of methods consumed with simple P/Invoke
• UIAv3
• Exists side-by-side with UIAv2 in the same dll
• COM object implementation
www.luxoft.com
UIAv2 vs UIAv3
UIAv2
• Better support for old applications, like WinForms or Win32
• Some stability issues
• Has managed .NET UIA wrapper
UIAv3
• More stable, faster
• Allows custom user-defined patterns
• Due to different implementation, control tree for some standard controls differ from UIAv2
• No Microsoft supported means to consume from .NET application
www.luxoft.com
Helper libraries
Since both P/Invoke and COM are inconvenient in .NET, several helper libraries emerged:
• TestStack.White
• Based on Managed UIA wrapper
• Has separate branch using UIAv3, mostly preserving same API layout
• FlaUI
• Most recent, supports both UIAv2 and UIAv3 out of the box
• More extensible
www.luxoft.com
Core features
• UIA elements discovering and identification
• Endpoint on UIA server to communicate with
• Communication protocol
• Getting elements’ properties:
• What is the text on this button I have?
• Invoking elements’ interactions:
• Click on the button
• Getting notifications on UIA events
• Call delegate every time new window is opened
www.luxoft.com
Tools
UIAv2
• UISpy
UIAv3
• Inspect
• VisualUIVerify
• FlaInspect
www.luxoft.com
Architecture picture
www.luxoft.com
UIA client specifics
• Initialize UIA
• Get root AutomationElement
• Descend via automationElement.Find*() family of methods to find necessary element
• Get its pattern implementation you need with GetPattern method
• Get properties and/or invoke pattern methods as necessary
www.luxoft.com
UIA server specifics
• Entry point is WM_GETOBJECT windows message
• Server needs to return pointer to raw element provider (IRawElementProviderSimple
implementation in most cases)
• That implementation is called by core UIA for patterns, methods and properties
• For example, to get value of some property – its ID is provided by core UIA and value is expected
in return
• To invoke pattern method – ID of the method is provided along with object[] with invocation
arguments
• Very tedious to implement directly
• Good thing is, all standard MS controls implement this out of the box
www.luxoft.com
WPF/UWP specifics
• Since WPF/UWP don’t have HWND for each control – they can’t receive WM_GETOBJECT
directly at control
• Instead, it provides WM_GETOBJECT functionality on the window-level, and everything else is
done inside WPF
• This functionality relies on AutomationPeer class (or descendant) exposed from
UIElement.OnCreateAutomationPeer method, and visual tree to discover child elements
• Thus, if you have custom control in WPF that does not have UIA implemented (and mostly it is
the case with third-party controls like Telerik or DevExpress) and you need to automate it – you
have to provide AutomationPeer for it
www.luxoft.com
Resources
• MSDN page on UIA
https://msdn.microsoft.com/en-us/library/ms747327(v=vs.110).aspx
• TestStack.White
https://github.com/TestStack/White
• FlaUI
https://github.com/Roemer/FlaUI
• Custom UIA patterns usage in .NET
https://github.com/TestStack/uia-custom-pattern-managed
• Series of blog posts on custom patterns in UIA by M. Bernstein
https://blogs.msdn.microsoft.com/winuiautomation/2010/12/07/uia-custom-patterns-part-1/
https://blogs.msdn.microsoft.com/winuiautomation/2010/12/10/uia-custom-patterns-part-2/
https://blogs.msdn.microsoft.com/winuiautomation/2010/12/27/uia-custom-patterns-part-3/
www.luxoft.com
THANK YOU
Q&A

More Related Content

Similar to Ivan Danilov «Desktop Application Automation: .NET Developer’s Perspective»

Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
Ido Flatow
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
Himanshu Dudhat
 
What is an Automation Framework ?
What is an Automation Framework ?�What is an Automation Framework ?�
What is an Automation Framework ?
Sriram Angajala
 
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
InfluxData
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
Peter Gfader
 
Introduction to Open Mano
Introduction to Open ManoIntroduction to Open Mano
Introduction to Open Mano
videos
 
Spring 1 day program
Spring 1 day programSpring 1 day program
Spring 1 day program
Mohit Kanwar
 
WebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 ApplicationsWebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 Applications
AnwarrChaudary
 
FME World Tour 2016: FME and continuous integration
FME World Tour 2016: FME and continuous integrationFME World Tour 2016: FME and continuous integration
FME World Tour 2016: FME and continuous integration
GIM_nv
 
automation framework
automation frameworkautomation framework
automation frameworkANSHU GOYAL
 
Introduction to WPF and MVVM
Introduction to WPF and MVVMIntroduction to WPF and MVVM
Introduction to WPF and MVVMSirar Salih
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
Siva Rama Krishna Chunduru
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone Development
Igor Kulman
 
Android architecture
Android architectureAndroid architecture
Android architecture
Deepa Rahul
 
Coded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object ModelCoded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object Model
Tharinda Liyanage
 
C# and dot net framework
C# and dot net frameworkC# and dot net framework
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
Khaja Moiz Uddin
 
Application Virtualization overview - BayCUG
Application Virtualization overview - BayCUGApplication Virtualization overview - BayCUG
Application Virtualization overview - BayCUGDenis Gundarev
 
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
Lizzy Guido (she/her)
 

Similar to Ivan Danilov «Desktop Application Automation: .NET Developer’s Perspective» (20)

Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
 
What is an Automation Framework ?
What is an Automation Framework ?�What is an Automation Framework ?�
What is an Automation Framework ?
 
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
Monitoring, Alerting, and Tasks as Code by Russ Savage, Director of Product M...
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
 
Introduction to Open Mano
Introduction to Open ManoIntroduction to Open Mano
Introduction to Open Mano
 
Spring 1 day program
Spring 1 day programSpring 1 day program
Spring 1 day program
 
WebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 ApplicationsWebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 Applications
 
FME World Tour 2016: FME and continuous integration
FME World Tour 2016: FME and continuous integrationFME World Tour 2016: FME and continuous integration
FME World Tour 2016: FME and continuous integration
 
automation framework
automation frameworkautomation framework
automation framework
 
Introduction to WPF and MVVM
Introduction to WPF and MVVMIntroduction to WPF and MVVM
Introduction to WPF and MVVM
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone Development
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Coded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object ModelCoded UI: Hand Coding based on Page Object Model
Coded UI: Hand Coding based on Page Object Model
 
C# and dot net framework
C# and dot net frameworkC# and dot net framework
C# and dot net framework
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Application Virtualization overview - BayCUG
Application Virtualization overview - BayCUGApplication Virtualization overview - BayCUG
Application Virtualization overview - BayCUG
 
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
 

More from LogeekNightUkraine

Face recognition with c++
Face recognition with c++ Face recognition with c++
Face recognition with c++
LogeekNightUkraine
 
C++20 features
C++20 features C++20 features
C++20 features
LogeekNightUkraine
 
Autonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, futureAutonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, future
LogeekNightUkraine
 
Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design" Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design"
LogeekNightUkraine
 
Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data" Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data"
LogeekNightUkraine
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
LogeekNightUkraine
 
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
LogeekNightUkraine
 
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
LogeekNightUkraine
 
Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"
LogeekNightUkraine
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
LogeekNightUkraine
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
LogeekNightUkraine
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
LogeekNightUkraine
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
LogeekNightUkraine
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
LogeekNightUkraine
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
LogeekNightUkraine
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
LogeekNightUkraine
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
LogeekNightUkraine
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
LogeekNightUkraine
 

More from LogeekNightUkraine (20)

Face recognition with c++
Face recognition with c++ Face recognition with c++
Face recognition with c++
 
C++20 features
C++20 features C++20 features
C++20 features
 
Autonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, futureAutonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, future
 
Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design" Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design"
 
Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data" Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data"
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
 
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
 
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
 
Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
 

Recently uploaded

Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 

Recently uploaded (20)

Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 

Ivan Danilov «Desktop Application Automation: .NET Developer’s Perspective»

  • 1. www.luxoft.com Desktop Application Automation: .NET Developer’s perspective Ivan Danilov
  • 2. www.luxoft.com Automation definition and goals • Microsoft UI Automation (UIA) is an application programming interface (API) that allows one to access, identify, and manipulate the user interface (UI) elements of another application [Wikipedia] • Application testing • Accessibility scenarios
  • 3. www.luxoft.com Availability • Available since Windows Vista / Windows Server 2008 • Part of Windows 7 and above right after OS install • Automates Win32, WinForms, WPF, UWP and other applications • Ability to automate depends on UIA support that can be implemented for any UI in theory • Frameworks and technologies listed above have UIA support out of the box
  • 4. www.luxoft.com UIA terminology • Server – application that is being automated • Client – automation driver, e.g. automated UI test • AutomationElement – basic building block; every piece of UI that is exposed to automation is represented with AutomationElement. They are contained in tree structure with desktop as the root • There’s no one-to-one relationship between automation elements and controls, but often it is the case • Control Patterns support the methods, properties, events, and relationships needed to define a discrete piece of functionality available in a control
  • 5. www.luxoft.com History and UIA versions • UIA is a successor to Microsoft Active Accessibility (MSAA) • MSAA functionality is preserved in UIA in form of LegacyIAccessible pattern • UIAv2 • Initial implementation • Set of methods consumed with simple P/Invoke • UIAv3 • Exists side-by-side with UIAv2 in the same dll • COM object implementation
  • 6. www.luxoft.com UIAv2 vs UIAv3 UIAv2 • Better support for old applications, like WinForms or Win32 • Some stability issues • Has managed .NET UIA wrapper UIAv3 • More stable, faster • Allows custom user-defined patterns • Due to different implementation, control tree for some standard controls differ from UIAv2 • No Microsoft supported means to consume from .NET application
  • 7. www.luxoft.com Helper libraries Since both P/Invoke and COM are inconvenient in .NET, several helper libraries emerged: • TestStack.White • Based on Managed UIA wrapper • Has separate branch using UIAv3, mostly preserving same API layout • FlaUI • Most recent, supports both UIAv2 and UIAv3 out of the box • More extensible
  • 8. www.luxoft.com Core features • UIA elements discovering and identification • Endpoint on UIA server to communicate with • Communication protocol • Getting elements’ properties: • What is the text on this button I have? • Invoking elements’ interactions: • Click on the button • Getting notifications on UIA events • Call delegate every time new window is opened
  • 11. www.luxoft.com UIA client specifics • Initialize UIA • Get root AutomationElement • Descend via automationElement.Find*() family of methods to find necessary element • Get its pattern implementation you need with GetPattern method • Get properties and/or invoke pattern methods as necessary
  • 12. www.luxoft.com UIA server specifics • Entry point is WM_GETOBJECT windows message • Server needs to return pointer to raw element provider (IRawElementProviderSimple implementation in most cases) • That implementation is called by core UIA for patterns, methods and properties • For example, to get value of some property – its ID is provided by core UIA and value is expected in return • To invoke pattern method – ID of the method is provided along with object[] with invocation arguments • Very tedious to implement directly • Good thing is, all standard MS controls implement this out of the box
  • 13. www.luxoft.com WPF/UWP specifics • Since WPF/UWP don’t have HWND for each control – they can’t receive WM_GETOBJECT directly at control • Instead, it provides WM_GETOBJECT functionality on the window-level, and everything else is done inside WPF • This functionality relies on AutomationPeer class (or descendant) exposed from UIElement.OnCreateAutomationPeer method, and visual tree to discover child elements • Thus, if you have custom control in WPF that does not have UIA implemented (and mostly it is the case with third-party controls like Telerik or DevExpress) and you need to automate it – you have to provide AutomationPeer for it
  • 14. www.luxoft.com Resources • MSDN page on UIA https://msdn.microsoft.com/en-us/library/ms747327(v=vs.110).aspx • TestStack.White https://github.com/TestStack/White • FlaUI https://github.com/Roemer/FlaUI • Custom UIA patterns usage in .NET https://github.com/TestStack/uia-custom-pattern-managed • Series of blog posts on custom patterns in UIA by M. Bernstein https://blogs.msdn.microsoft.com/winuiautomation/2010/12/07/uia-custom-patterns-part-1/ https://blogs.msdn.microsoft.com/winuiautomation/2010/12/10/uia-custom-patterns-part-2/ https://blogs.msdn.microsoft.com/winuiautomation/2010/12/27/uia-custom-patterns-part-3/