I want to download a file during Selenium automation in IE,and so far i tried below code by after button click by adding AutoIt library in C# class file ,but this one is not working.. Can any one help what I am missing?
Thanks in advance.
IntPtr temp = AutoItX.WinGetHandle("[Class:IEFrame]");
AutoItX.ControlGetHandle(temp, "[Class:DirectUIHWND]");
Thread.Sleep(1000);
AutoItX.WinActivate(temp);
AutoItX.ControlClick("[Class:DirectUIHWND]", "", "");
AutoItX.ControlSend("", "", "[ClassNN:DirectUIHWND]", "{F6}");
Thread.Sleep(500);
AutoItX.ControlSend("", "", "[Class:DirectUIHWND]", "{TAB}");
Thead.Sleep(500);
AutoItX.ControlSend("", "", "[Class:DirectUIHWND]", "{ENTER}");
Thread.Sleep(500);
I usually direct selenium to click the button/link to download the file, so that a Windows explorer window appears, and take it from there with AutoIT.
Something like this:
driver.[locate the button/link that downloads the file]
driver.[click that button/link]
(perhaps a wait here)
system.[fire up the autoIT executable that handles the windows explorer window]
carry on from there
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.