Search code examples
seleniumautoit

automate image upload from windows explore with selenium and AutoIT


I have to automate a scenario like a upload an image from windows explorer to TinyMCE component using Selenium. Since Selenium does not support OS control, I used AutoIt to upload the image. AutiIt sets the image path to "File name" and seems like it clicks on 'Open' button as well. But the image is not loading to my "source" field.

Here is my Selenium command:

Runtime.getRuntime().exec("C:/XXXXX/src/test/resources/uploadImage.exe");
// Path of the AutoIT script file

AutoIT script:

WinActivate("Open")
Send("C:\LCNGProjects\Screenshots\Images\GifImage1.gif")
Sleep(5000)
Send("{ENTER}")

Refer the attached screenshot

Refer the attached screenshot


Solution

  • Not sure if I have got the questions correct, Did you compile the script.

    Can you please go through link below for script compilation and step by step info how to upload a file.

    https://www.guru99.com/use-autoit-selenium.html