Integrating AutoIT Tool with Selenium

In this tutorial, we will learn Integration of AutoIT tool with Selenium WebDriver. While testing any web application, many a time we come across a situation where we have to interact with “Windows-based UI” elements. One of the most common scenarios is while uploading or downloading an image file.

Selenium WebDriver does not provide any inbuilt functionality to interact with Windows-based UI elements. In this situation, we have to take help of some third party tool. There are hundred’s of third party tools which are available in the market. AutoIT is one of the best open-source, easy to use tool available in the market.

Let us learn integration of AutoIT tool with a practical scenario.

Practical Scenario: Uploading an image on google:


  1. Open a browser of your choice (say Google Chrome)
  2. Navigate to “”
  3. Click camera icon –> Upload an Image –> Browse
  4. Window based UI opens up. Refer below images for same.

Upload an Image

Uplad an Image

windows based popup

Now, to interact with this windows-based UI. We will use AutoIT tool.

Environment Setup for AutoIT:

Steps to follow:

  1. Download and install AutoIT tool and its editor.

Refer the screenshot below:

autoit download

After installing AutoIT tool, open the editor and write the script. Now here, the script will be first, wait for the upload window to get active and  then pass the absolute path of the image and  then press enter.

Title of the window:

For Mozilla Firefox: Upload File

For Chrome: Open

// Wait till window with title appears

//Send the path of image file

//Press Enter key

See the below screenshot for the reference.


After completing the script, to execute it first compile the code. After compiling the code an exe file will be generated.

Call this exe in your selenium code by below command:


Refer below code for complete scenario:

package day11;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;

public class FileUpload {

	public static void main(String[] args) throws IOException {
		System.setProperty("", "C:\\Users\\sdhingra\\workspace\\libs\\chromedriver.exe");
		WebDriver Driver = new ChromeDriver();
		Driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
		Driver.findElement(By.xpath("//span[contains(text(), 'Upload an image')]")).click();

		//To execute any exe file from java



This is how AutoIT tool can be integrated with Selenium.

For any questions, queries or comments feel free to write us at or Happy Learning ?

Saurabh Dhingra

About the Author

Saurabh Dhingra

Follow Saurabh Dhingra: