SlideShare a Scribd company logo
1 of 14
Download to read offline
WinAppDriver Development
Jeremy Kao (about.me/imsardine) @ KKBOX SQA

17/12/2014
Agenda
• Environment Setup

• JSON Wire/WebDriver Protocol
and Routing

• WinAppDriver Components

• TODO
WinAppDriver Overview
Test
WinAppDriver
UIA Client API
WPFWinFormsWin32
http://*:4444/wd/hub
Test
Windows DevicesWin & Unix-like
JSON/WebDriver!
Wire Protocol
Lang.
Bindings
DEV Environment Setup
• Prerequisites
• .NET Framework 3.0 (Vista) and above.
• Windows SDK
• Configure PATH environment variable

SET PATH=%PATH%;C:WindowsMicrosoft.NETFramework<VERSION>;C:
Program Files (x86)Windows Kits<VERSION>bin<ARCH>
• Get the source code from GitHub

git clone git@github.com:imsardine/winappdriver.git
• Build the project

msbuild.exe src/ActivateStoreApp/ActivateStoreApp.csproj

msbuild.exe src/WinAppDriver/WinAppDriver.csproj
Deployment
• Prerequisites
• .NET Framework 3.0 (Vista) and above.
• Windows 8.0 and above for store apps.
• Configure firewall and URL namespace reservations.
• Import WinAppDriver Test Certificate to Trusted Root
Certification Authorities store.
• Copy the following files to a secure location

WinAppDriver.exe, ActivateStoreApp.exe, Newtonsoft.Json.dll
JSON/WebDriver Wire Protocol
• The WebDriver Wire Protocol - Selenium
• For example
• Find an element

POST session/:sessionId/element
• Click an element

POST session/:sessionId/element/:id/click
Routing
• Endpoints

POST session/:sessionId/element
• Handlers with Route attribute (WinAppDriver.RouteAttribute)

[Route("POST", "/session/:sessionId/element")]

class FindElementHandler : IHandler {

...

}
• RequestManager.AddHandler(handler)
Handler
WinAppDriver Components
HTTP
Server
Request

Manager
Session

Manager
Handler
UIA

Client API
WebDriver
Lang. Bindings
HTTP Server (WinAppDriver.Server)
• Based on System.Net.HttpListener
• Listen on http://+:4444/wd/hub/
• Configure firewall and Namespace Reservations

(elevated mode)

netsh http add urlacl url=http://+:4444/wd/hub/ user=Everyone
Request Manager (WinAppDriver.RequestManager)
• Manage endpoints (WinAppDriver.EndPoint) and handlers
(WinAppDriver.IHandler).
• Dispatch requests to corresponding handlers.
• Parse URL parameters and prepare the session object.
• Serialise returned object(s) to JSON.
Handlers (WinAppDriver.IHandler)
1. Parse request body, that is deserialising JSON

FindElementRequest request =
JsonConvert.DeserializeObject<FindElementRequest>(body);
2. Search for or manipulate UI elements using the UIA Client API.
3. Return a Dictionary or Data Transfer Object (DTO).

return new Dictionary<string, object> {

{ "sessionId", session.ID },

{ "status", 0 },

{ "value",

new Dictionary<string, int> {

{ "ELEMENT", id }

}

}

};
Session Manager (WinAppDriver.SessionManager)
• Manage sessions (WinAppDriver.Session).
• A session caches references to UI elements
(System.Windows.Automation.AutomationElement) for
subsequent interactions.
TODO
• Build system
• Solution file (.sln)
• Remove third-party assemblies from Git repo.
• Travis CI build (low priority)
• Exception handling, e.g., throw new ElementNotFoundException()
• Discover and register all handlers automatically.
• Download, install and uninstall app packages automatically.
• Implement remaining commands defined in the protocol. (logs, screenshots,
…)
• Fast reset - clear data without uninstalling the package
References
• Configuring HTTP and HTTPS - MSDN
• MSBuild
• P of EAA: Data Transfer Object

More Related Content

What's hot

Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for seleniumapoorvams
 
Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Yaroslav Pernerovsky
 
Customising QGroundControl
Customising QGroundControlCustomising QGroundControl
Customising QGroundControlGodfrey Nolan
 
Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6AIMDek Technologies
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot trainingMallikarjuna G D
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Orion Context Broker 20211209
Orion Context Broker 20211209Orion Context Broker 20211209
Orion Context Broker 20211209Fermin Galan
 
Entity Framework Core
Entity Framework CoreEntity Framework Core
Entity Framework CoreKiran Shahi
 
06 laboratory exercise 1
06 laboratory exercise 106 laboratory exercise 1
06 laboratory exercise 1Anne Lee
 
Cbt component based technology architectures
Cbt   component based technology architecturesCbt   component based technology architectures
Cbt component based technology architecturesSaransh Garg
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafThymeleaf
 
TEI HAL - import SWORD
TEI HAL - import SWORDTEI HAL - import SWORD
TEI HAL - import SWORDOAccsd
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room LibraryReinvently
 
엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나종민 김
 

What's hot (20)

Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Django forms
Django formsDjango forms
Django forms
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 
Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.Implicit and Explicit waits in Selenium WebDriwer, how to.
Implicit and Explicit waits in Selenium WebDriwer, how to.
 
Customising QGroundControl
Customising QGroundControlCustomising QGroundControl
Customising QGroundControl
 
Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Express js
Express jsExpress js
Express js
 
Orion Context Broker 20211209
Orion Context Broker 20211209Orion Context Broker 20211209
Orion Context Broker 20211209
 
Entity Framework Core
Entity Framework CoreEntity Framework Core
Entity Framework Core
 
06 laboratory exercise 1
06 laboratory exercise 106 laboratory exercise 1
06 laboratory exercise 1
 
Cbt component based technology architectures
Cbt   component based technology architecturesCbt   component based technology architectures
Cbt component based technology architectures
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
 
JSON and XML
JSON and XMLJSON and XML
JSON and XML
 
TEI HAL - import SWORD
TEI HAL - import SWORDTEI HAL - import SWORD
TEI HAL - import SWORD
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room Library
 
엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나
 

Similar to WinAppDriver Development

Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0Ido Flatow
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.jsAyush Mishra
 
Yogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’sYogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’sYogesh Kushwah
 
GWT Enterprise Edition
GWT Enterprise EditionGWT Enterprise Edition
GWT Enterprise EditionGilad Garon
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetesBen Hall
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7WASdev Community
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7Kevin Sutter
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...Malin Weiss
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...Speedment, Inc.
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The WhenFITC
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WSKatrien Verbert
 
Elements for an iOS Backend
Elements for an iOS BackendElements for an iOS Backend
Elements for an iOS BackendLaurent Cerveau
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.pptWalaSidhom1
 

Similar to WinAppDriver Development (20)

Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
signalr
signalrsignalr
signalr
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.js
 
Yogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’sYogesh kumar kushwah represent’s
Yogesh kumar kushwah represent’s
 
GWT Enterprise Edition
GWT Enterprise EditionGWT Enterprise Edition
GWT Enterprise Edition
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
JSF2
JSF2JSF2
JSF2
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
 
Elements for an iOS Backend
Elements for an iOS BackendElements for an iOS Backend
Elements for an iOS Backend
 
Windows 8 Apps and the Outside World
Windows 8 Apps and the Outside WorldWindows 8 Apps and the Outside World
Windows 8 Apps and the Outside World
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 

Recently uploaded

tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 

Recently uploaded (20)

tonesoftg
tonesoftgtonesoftg
tonesoftg
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 

WinAppDriver Development

  • 1. WinAppDriver Development Jeremy Kao (about.me/imsardine) @ KKBOX SQA
 17/12/2014
  • 2. Agenda • Environment Setup • JSON Wire/WebDriver Protocol and Routing • WinAppDriver Components • TODO
  • 3. WinAppDriver Overview Test WinAppDriver UIA Client API WPFWinFormsWin32 http://*:4444/wd/hub Test Windows DevicesWin & Unix-like JSON/WebDriver! Wire Protocol Lang. Bindings
  • 4. DEV Environment Setup • Prerequisites • .NET Framework 3.0 (Vista) and above. • Windows SDK • Configure PATH environment variable
 SET PATH=%PATH%;C:WindowsMicrosoft.NETFramework<VERSION>;C: Program Files (x86)Windows Kits<VERSION>bin<ARCH> • Get the source code from GitHub
 git clone git@github.com:imsardine/winappdriver.git • Build the project
 msbuild.exe src/ActivateStoreApp/ActivateStoreApp.csproj
 msbuild.exe src/WinAppDriver/WinAppDriver.csproj
  • 5. Deployment • Prerequisites • .NET Framework 3.0 (Vista) and above. • Windows 8.0 and above for store apps. • Configure firewall and URL namespace reservations. • Import WinAppDriver Test Certificate to Trusted Root Certification Authorities store. • Copy the following files to a secure location
 WinAppDriver.exe, ActivateStoreApp.exe, Newtonsoft.Json.dll
  • 6. JSON/WebDriver Wire Protocol • The WebDriver Wire Protocol - Selenium • For example • Find an element
 POST session/:sessionId/element • Click an element
 POST session/:sessionId/element/:id/click
  • 7. Routing • Endpoints
 POST session/:sessionId/element • Handlers with Route attribute (WinAppDriver.RouteAttribute)
 [Route("POST", "/session/:sessionId/element")]
 class FindElementHandler : IHandler {
 ...
 } • RequestManager.AddHandler(handler)
  • 9. HTTP Server (WinAppDriver.Server) • Based on System.Net.HttpListener • Listen on http://+:4444/wd/hub/ • Configure firewall and Namespace Reservations
 (elevated mode)
 netsh http add urlacl url=http://+:4444/wd/hub/ user=Everyone
  • 10. Request Manager (WinAppDriver.RequestManager) • Manage endpoints (WinAppDriver.EndPoint) and handlers (WinAppDriver.IHandler). • Dispatch requests to corresponding handlers. • Parse URL parameters and prepare the session object. • Serialise returned object(s) to JSON.
  • 11. Handlers (WinAppDriver.IHandler) 1. Parse request body, that is deserialising JSON
 FindElementRequest request = JsonConvert.DeserializeObject<FindElementRequest>(body); 2. Search for or manipulate UI elements using the UIA Client API. 3. Return a Dictionary or Data Transfer Object (DTO).
 return new Dictionary<string, object> {
 { "sessionId", session.ID },
 { "status", 0 },
 { "value",
 new Dictionary<string, int> {
 { "ELEMENT", id }
 }
 }
 };
  • 12. Session Manager (WinAppDriver.SessionManager) • Manage sessions (WinAppDriver.Session). • A session caches references to UI elements (System.Windows.Automation.AutomationElement) for subsequent interactions.
  • 13. TODO • Build system • Solution file (.sln) • Remove third-party assemblies from Git repo. • Travis CI build (low priority) • Exception handling, e.g., throw new ElementNotFoundException() • Discover and register all handlers automatically. • Download, install and uninstall app packages automatically. • Implement remaining commands defined in the protocol. (logs, screenshots, …) • Fast reset - clear data without uninstalling the package
  • 14. References • Configuring HTTP and HTTPS - MSDN • MSBuild • P of EAA: Data Transfer Object