How to Handle File Upload Window with AutoIt in Selenium?

I think this problem (uploading a file) is faced by many of us in selenium webdriver because this file upload window is NOT handled by selenium’s .getWindowHandle() method. This .getWindowHandle() method is applicable for handling only web browsers pop up, not the window pop ups. So to handle this type of window pop ups we take the help of third party tools like AutoIt.

Now let’s discuss something about AutoIt.

AutoIt is a freeware scripting language which is used to automate windows applications and general scripting. Here we use AutoIt to handle file upload window pop up.

For implementing AutoIt in our selenium code we need to do following steps-

1. Download AutoIt & AutoIt Editor and install it on your system as per your system requirement (32bit or 64 bit). To download AutoIt & AutoIt Editor you can go to https://www.autoitscript.com/site/autoit/downloads/

Download AutoIt & AutoIt Editor


2. Open AutoIt v3 Script Editor, write the below code & save it.



3. Compile the above created .au3 file as per your system requirement i.e.(32 bit or 64 bit)



4. It creates .exe file.


5. Now use this executable file in your selenium code.

executable file in your selenium code


These were the steps to handle window upload popup by using the AutoIt in Selenium Webdriver. I would be updating you on testing approaches in my coming blogs.

If you have any queries in this one, please drop your comments below.

You might also like