I'm trying to upload a system file. To do this I use AutoIt, the following code is the script that I wrote to upload the file (an AutoIt script):
Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare
Main()
Func Main()
Local Const $dialogTitle = $CmdLine[2]
Local Const $timeout = 5
Local $windowFound = WinWait($dialogTitle, "", $timeout)
$windowFound = WinWait($dialogTitle, "", $timeout)
Local $windowHandle
If $windowFound Then
$windowHandle = WinGetHandle("[LAST]")
WinActivate($windowHandle)
ControlSetText($windowHandle, "", "[CLASS:Edit; INSTANCE:1]", $CmdLine[1])
ControlClick($windowHandle, "", "[CLASS:Button; TEXT:&Open]")
Else
MsgBox(0, "", "Could not find window.")
Exit 1
EndIf
EndFunc
After this I compiled the script, the below script that I wrote to execute the .exe
file created is:
Process process = new ProcessBuilder("C:\\Users\\selenium\\auto.exe",
"C:\\Users\\selenium\\test.png", "Open").start();
There is a choose file button in my application, my test case is working untill clicking that button, after opening the system window. Then I'm not able to open the file with the directory specified above.
I'm using Selenium Web Driver Version -- 2.33 with FireFox version 21 and AutoIT version 2.28