I have searched thoroughly on this but in vain. My issue is I have written the AutoIT script which works perfectly when its executed outside the C# or Java code. The script is:
WinWaitActive("File Upload")
Send("C:\Users\faris\Desktop\RP1.jpg")
Sleep(2000)
ControlFocus("File Upload","","Button1")
Send("{Enter}")
I made sure that my code is calling the same exact script. When this script is executed in the program, The 'File Upload' dialog box opens up, I can see the file path is also displayed in the 'File name' field. but then the dialog box just quits and the file is not uploaded. technically the 'Open' button on the dialog box is not being clicked. Now, I have tried using the 'Control Click' command but its just the same. I have also tried every type of Waits but its of no use. I am new to this and would really appreciate any kind of help.
Here's the code example:
IWebElement browse = driver.FindElement(By.Id("browse"));
browse.SendKeys(Keys.Enter);
Thread.Sleep(2000);
Process.Start("C:\\Users\\faris\\Desktop\\Autoit2.exe");
"Browse" is the 'Upload file' button and sending an 'Enter' key invokes File upload dialog box in Firefox.
