August 26, 2015

Integrate AutoIT with Selenium Webdriver

In this post we will discuss about how to Integrate AutoIT with Selenium Webdriver.

Need of AutoIT in Webdirver:

Webdriver can only interact with web applications, it can not interact with desktop components or Browser related popups. 
Here are some of the situations where we need to take help of 3rd Party tools (Auto IT).

  1. File Uploads.
  2. Downloads.
  3. Handling User Authentications etc..

We will see below points:
1. What is AutoIT
2. Features of AutoIT
3. How to Install?
4. How to use?
5. Integrate AutoIT and Webdriver

What is AutoIT and Features :

AutoIt v3 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 in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!


  • Easy to learn BASIC-like syntax
  • Simulate keystrokes and mouse movements
  • Manipulate windows and processes
  • Interact with all standard windows controls
  • Scripts can be compiled into standalone executables
  • Create Graphical User Interfaces (GUIs)
More details you can find here  --AutoIT Features

Install AutoIT:

To install AutoIt first download the AutoIt exe file from the below location.


1. Click on the topmost download for AutoIT
2. Follow the instructions to install AutoIT.


Record AutoIT script:
AutoIT has record feature. We can record script using AutoIT, for that we need AutoIT script Editor.

Download AutoIT Script Editor:
In Auto IT downloads page we have one more file called "Download Editor". Once you click on that it will navigte to downlaods page, then download "SciTE4AutoIt3.exe" file.

How to Use:

Scenario:
1. Navigate to http://www.dropzonejs.com/
2. Click on Try it Out section --It will open window (upload file window)
3. select a file and click open
4. Verify uploaded file in Try it Out section.



First lets see how to create AutoIT script to upload file.

If you want help about commands you can navigate to Start  > All Program > AutoIt v3  > Autoit Help file.  and search for commands.

In the above scenario i need to upload file. After clicking on try it Out it will open a Upload file window.
Need to identify Locators (text box).  AutoIt has given us Windows Info tool, it is same like Object Spy in QTP and Element Inspector in any Browser. To open it go to Start > All Program > AutoIt v3 > AutoIt Window Info.

Now drag the ‘Finder Tool‘ box to the object in which you are interested.


You can see that Windows Info tool has populated all the information which is required to use the method.

Write Automation script to Upload file:





Save that file with extension .au3 and Convert script to .exe file.



After compilation you will get Upload.exe file.

How to use file in Webdriver:


Runtime.getRuntime().exec("D:\downloads\Uplaod.exe");


Below is the code how to use Auto It in Webdirver:








5 comments:

  1. The Information which you provided is very much useful for Testing Training Learners Thank You for Sharing Valuable Information. I like this blog and this is very informative. Selenium Training in Chennai

    ReplyDelete
  2. integrate autoit with selenium nic eposts..


    Big data training .All the basic and get the full knowledge of hadoop.
    Big data training

    ReplyDelete
  3. The blog gave me idea to integerate auto IT Thanks for sharing it
    Selenium Training in Chennai

    ReplyDelete
  4. really you have posted an informative blog. it will be really helpful to many peoples. so keep on sharing such kind of an interesting blogs. before i read this blog i didn't have any knowledge about this but now i got some knowledge.
    selenium training in chennai

    ReplyDelete