Sunday 15 January 2017

Selenium for Desktop Application - Winium

Wish you all Happy New Year 2017. This year, I am planning to bring more tools, techniques and frameworks for all my readers.

I have few requests around the Windows based application automation which will be as simple as Web based automation using Selenium. Hence I thought of writing this post on "Winium" which is  "Selenium for Desktop Application - Winium"

Winium is simply Selenium Remote WebDriver  implementation for testing Windows based application. Winium can be useful for Windows based application based on WinForms and WPF platforms. We need other drivers as well if the Application under test is Silverlight application. However the control positions can be the best option for some of the tricky applications.

So when we are working on the complex applications pool under test and do not want license tools to complete the test automation requirement for Windows, Web and Mobile then we can consider Selenium for all in different forms. Hence for Windows - Winium, Web - Selenium WebDriver and for Mobile Appium.

As Selenium supports Java, C#, PHP, Ruby, Python like languages, Winium also supports. As we have seen that Winium desktop driver implements Selenium Remote WebDriver and listens for JsonWireProtocol and use Winium Cruciatus, Winium Cruciatus is a C# framework for WinForms and WPF Platforms.

Now, we have option to use core C# framework using Winium.Cruciatus or Selenium WebDriver remote using Winium.Desktop. Here the difference is the prior helps to write a code in C# using System.Windows.Automation namespace and the later helps to write the automation script in Selenium supported languages.

As WebDriver implementation is simple, lets talk about core C# implementation using Winium. Cruciatus wrapper on the System.Windows.Automation namespace.  First we need to add the reference to the project and then we need to create the mapping. Once the mapping  is created use the mapping in tests. Its simple.

Please refer example here -
https://github.com/2gis/Winium.Cruciatus/tree/master/src/TestApplications.Tests

Happy Automating Desktop Applications!