My AutoIt script should upload files using a browser:
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\MWUploads\myFile.pdf")
ControlClick("Open","","Button1")
I'm using above script's compiled executable from Selenium WebDriver for Java:
Runtime.getRuntime().exec(autoItScExecutableDir+"autoitScript.exe");
Depending on browser, title of upload popup window differs (for Google Chrome and Microsoft Edge it's "Open" whereas for Firefox it is "File Upload"). How can I make it work for any file path on any browser, like below?
Runtime.getRuntime().exec(myWinTitle, myLocator, myFileToUploadPath);
//attaching an img for more clarification, when tried as per Answer
Here is the o/p of sysOut from else block-
E:\AOS\src\test\resources\AutoItScripts\dynamicAutoItScript.exe File Upload
E:\AOS\src\test\resources\FilesToUpload\Greetings.png

