What is Winium? | Benefits of using Winium | Tutorials
Winium is an open-source Automation Framework used to Automate Desktop based Applications. Built on the Selenium library to interact with Windows applications, winium is very simple to learn for Testers who have prior knowledge and are familiar with Selenium WebDriver.
Winium works with all WebDriver compatible programming languages such as – Python, Java, C#, Ruby, PHP, JavaScript, etc. It is a free tool and we can automate all types of client-based applications with the help of this tool. Based on the implementation of Selenium Remote WebDriver, Winium is the preferred automation testing tool for windows desktop application. It is available for both Desktop Applications Automation and Mobile application Automation.
So far Winium is the only selenium based tool that is open source and free which can be used to Automate client-based applications. Its library does not support Mac and Ubuntu-based Operating Systems.
Winium Download
Winium is very easy to use and we can download Winium Driver from the below location.
Click Here to download.
The last release of Winium Driver was on Sep 30th, 2016 and the latest version of Winium is 1.6.0.
Download Winium driver
Winium Driver comes in a zip file, extracts the file and saves it inside your Java Project so that the Winium Driver will be added in your project source code. If you are using a Maven Project, you can also add the Winium Driver dependency in your POM.xml file, here is the dependency code:
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-webdriver</artifactId>
<version>0.1.0-1</version>
</dependency>
Winium Tutorial Java
Winium Tutorial – To launch Winium Driver, you need to import the following libraries:
- a) import org.openqa.selenium.winium.DesktopOptions;
- b) import org.openqa.selenium.winium.WiniumDriver;
Once the language-specific client libraries are imported in the Java Class, use the below line of code to start Winium Driver and launch the application:
public DesktopOptions option = null;
public static WiniumDriver driver = null;
public void initiateDriver() {
try {
option = new DesktopOptions();
option.setApplicationPath(System.getProperty(“user.dir”)+”\\resources\\TestFile.txt”);
driver = new WiniumDriver (new URL (“http://localhost:9999”), option);
}catch(Exception e) {
System.out.println(e);
}
}
The DesktopOptions library is used to set a path of the Application which needs to be Automated and this path we need to pass to the Winium Driver.
We have also initiated Winium Driver with the localhost URL and the port number, this we get when we start the Winium Server.
Two ways to start the Winium server:
1: By running the .exe file through the command line
OR
2: By writing a batch file with the instructions to execute the Winium Driver .exe file.
Automating windows based application using Winium
Benefits of Winium over other tools
Though Winium is not so popular as compared to other automation tools that are being used to Automate Windows-based Applications, it is a free and open-source tool with pros of its own. Below are some of the benefits of working with Winium over other tools.
Open Source
We need not buy any license. So there is a huge saving on the yearly license cost. As compare to other popular tools such as MicroFocus-UFT(Unified Functional Testing) – $3200, SmartBear-TestComplete – $4,600, Ranorex – $3590, Tricentis Tosca – $2,800, TestArchitect – $5,990 etc.
Multiple Testing Framework options
With Winium, we can use any Testing Framework such as TestNG, Junit, Nunit, PyUnit, etc.
Easy to use and Understand
Selenium WebDriver API is easy to understand and explore and to locate web elements in web applications with Selenium WebDriver we have multiple options such as CroPath, Xpather, and various firefox plugins. Similarly, in Winium to locate desktop-based elements or we may say identify the element, we have UISpy and Inspect.exe.
Convenient Automation framework implementation
We can use Winium with any of the Frontend Testing libraries such as Cucumber, Gauge, or Gherkin based Feature Files to read the test Automation steps. We can also implement any of the Automation Framework such as – Page Object Model Framework, Data Driven Framework, Keyword Driven Framework, or Robot Framework.
Conclusion
With automation becoming the need of the hour, Winium could be an ideal option when it comes to windows automation. This framework can automate any desktop application developed on windows.
Our experienced team of software developers and testers at TestingGenez are well versed in providing extrusive testing services across different verticals. We have done a simple Case Study for Notepad Windows-based Application.
We have automated three scenarios which have both positive tests for Finding and Replacing words and a negative test. We were also able to generate reports in a CSV file.