Selenium with Autoit (no installation) for win UIs

As most of us know, Autoit is a tool to automate basic navigations for non browser / windows applications.

There are situations in selenium automation, we get window dialog or we can say non browser related dialog which can not be automated with selenium. e.g Upload a file, download a file etc..

We will see how we can integrate Autoit with Selenium without installing Autoit.


Most of the sites / documents provide very nice explanation about usage of Autoit tool (basically they say to install the autoit and then we kind of record the navigations and create an exe file, which we call in our selenium programming)

While browsing for selenium topics, got a nice post of Joe Colantonio about autoit automation, with out installation.

so let’s see how we can integrate autoit with selenium without installing.

The concept is to access Autoit through COM (Component object model, used for inter process communication) using Jacob  (Java-COM bridge), and register the AutoitX3.dll in to our machine.

Pre-requisites:

Download Autoit zip file,
https://www.autoitscript.com/site/autoit/downloads/

Extract to get the
AutoItX3.dll
AutoItX3_x64.dll
Note: Let’s say, extracted the autoit zip file in C: drive, then the required files are under
C:autoit-v3installAutoItX

Download Jacob zip file, 
http://sourceforge.net/projects/jacob-project/

extract to get the
jacob.jar
jacob-1.18-x64.dll  [for 64 bit JVM]
jacob-1.18-x86.dll  [for 32 bit JVM]


To know 32 or 64 bit of JVM on your machine, use following code in java


Create a folder (lib) under your current project folder, and copy jacob-1.18-x64.dll and jacob-1.18-x86.dll into the lib folder.  will use in the code…

Download AutoitXJava.jar file
https://code.google.com/p/autoitx4java/downloads/list

In Eclipse

Load below jar files into eclipse Java Build Path, by creating a new project / to an existing project:
jacob.jar | AutoitXJava.jar

Register AutoItX

For 32 bit OS:
Click on Windows -> Run.., enter: regsvr32 c:autoit-v3installAutoItX/AutoItX3.dll
For 64 bit OS:
Click on Windows -> Run.., enter: regsvr32 c:autoit-v3installAutoItX/AutoItX3_x64.dll

If above statement doesn’t work, then Open cmd (Run as Administrator) and type above command
you should see

Scenario: we have a file, test.txt under c:test folder, we need to upload to qavalidation.com demo site….
To identify the elements in the file upload dialog (non browser app), we need to use Au3Info.exe as spy tool

Let’s jump to code implementation:

 

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

1 Response

  1. June 7, 2016

    […] Refer our earlier post Autoit with selenium […]

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: