Wednesday, November 26, 2014

Automate a Web/Desktop application by using AutoIt

Introduction

A few days ago we talked about the possibility to use a Sikuli library in Selenium in order to perform integration tests between a web and a desktop application. Sikuli uses visual identification to automate and test graphical user interfaces (GUI). It automates anything you see as a user on the screen without being necessary to identify objects.

This tool can be used also in selenium when we interact with native UI. For example, the web application provides a file upload/download feature that invokes native OS UI for selecting a file, or when we are required to enter credentials in a password popup, or when it is very difficult to identify elements from a chart, for example.


Another way to do this is to use AutoIt which it is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks.

More about AutoIt

You can download the tool from https://www.autoitscript.com/site/autoit/downloads/. You need to download AutoIt latest version and the editor SciTE. After installation you can create shortcuts for AutoIt Window InfoSciTE and Au3Record.



AutoIt Window Info is used to identify objects on the screen. Think about Firebug. It's something similar.


Au3Record is used to record actions you perform. Think about Selenium IDE. The recorder can be found in the installation path under ..AutoIt3\Extras\Au3Record\Au3Record.exe.



SciTE is an editor you can use to write your tests. Bellow you can see the code for the test previously recorded.



After you write the test go to Tools-->Compile and an .exe file will be generated in the specified folder. 
We will not continue telling more about how to write tests in AutoIt, because this is a separate discussion. The question is how to integrate the script in Selenium?

Integrate Selenium WebDriver and AutoIt scripts

Well, this is very simple :
where

If I'd have to choose between Sikuli and AutoIt to perform integration tests between Web and Desktop, I'll use Sikuli. But for cathing UI elements like upload/download., I'll use AutoIt.

No comments:

Post a Comment

Popular Posts