Automate Desktop app using selenium like tool.

Automate Desktop app using selenium like tool.

Most recently I worked on a project, where automating integration scenario between Web and Windows application was required. So started googling for available tools that would solve my purpose of Desktop-Web application automation. I came across a lot of options like Auto-It, TestStack, etc.

I was a bit upset since I had to create a different framework altogether in order to automate desktop application. Due to the tight deadline that was somehow not possible. I started looking for other alternatives that would get integrate easily with my Selenium framework and would solve serve both Windows and Web application automation.

Came across interesting tool name “Winium”. Which appears to be based on Selenium and scripting is similar to Selenium. That definitely made me happy. Now questions arise “How easy it is to Automate? What are the prerequisites? etc. Let me answer all of them.

What is Winium? Why Winium?

Winium is a selenium-based open source tool used for automating Desktop application on windows desktop. It’s similar to Selenium used for Web Application Automation or Appium that is used for Mobile Application automation.

Since it’s a selenium-based tool, hence Winium can be scripted across all language that Selenium supports i.e Java, C#, JavaScript, Ruby, Perl, etc

How to inspect element in Winium?

Similar to FireBug or FirePath that we use in Selenium for inspecting element in Web Application, in case of Winium we have multiple inspectors, one that I prefer is Inspect.exe which can be downloaded from here. Once the Installation is completed then we can open Inspect.exe from the location where the installation is done.

As soon as Application opens up it lists down all the desktop application that is currently open. Inspect application’s UI would typically look like below. Let’s focus on Calculator application for now.

The left panel displays the list of Desktop application that is open. Right panel displays the property of the element that is selected in the Left panel. We can consider Right panel as DOM which we get after inspecting an element in a web application.

It's time to get our hands dirty

I am using Visual Studio 2017 IDE with C# language to demonstrate the Winium functionality. Similar to Appium or Selenium user will have to import a package of Winium from NuGet Package Manager in Visual Studio after project creation is done.

Once the project is created from Class View section in the right-hand side user will right click on the Solution and would click on “Manage NuGet Packages”. Click on the Online section and search for Winium.Cruciatus, once the result is obtained Install the package.

Once the packages are installed, we will have to define the application path that needs to be automated. In our case, it would be the calculator application.

Similar to Selenium or Appium in case of Winium we have can perform different operations ( For Eg: Click ) on the target element.

Added is the code snippet for automating calculator application entire solution can be downloaded from here.

In order to use existing code base after downloading from above repository please build the solution and run it by pressing F5 key.

Bringing it up altogether

As we can see scripting format of Winium is similar to Selenium, so by just installing an additional package, we are good to go ahead with Desktop application automation from our existing Selenium/Appium framework ( in case we have ). Thus Winium can easily be integrated with Selenium or Appium and can be used for automating Web/Mobile Application’s integration test cases with the desktop application.

Thus, in a nutshell, we can say Winum when integrated with Selenium or Appium provides one stop solution for Web, Mobile and Desktop application automation.

Please share your thoughts in the comment section, we can connect on LinkedIn and talk more. If you enjoyed this post, I’d be very grateful if you’d help it spread it to your connections on LinkedIn or other channels.

Thank you!


Rohit Prakash

Microsoft Certified Azure Admin Associate | Cloud Enthusiast | Devops Engineer | CI/CD | Azure DevOps | Jenkins | GitLab CI | Terraform | Docker | Ansible | SonarQube | Bitbucket

4 年

Hi Suraj.. can we automate windows PC app using this? Because windows pc app usually get isntalled in a hidden folder that is C:\Program Files\WindowsApps.. And due to permission issues we cannot really access this folder at times . Can we add some driver capabilities in winium too like we do in WinAppDriver?

要查看或添加评论,请登录

Suraj Sharma的更多文章

社区洞察

其他会员也浏览了