0

I want to remotely run a download test under IE. I'm looking for any way to do it (on a remote machine) even if I have to use another tool such as autoit (which doesn't seems accurate regarding to the remote aspect).

My problem : When IEWebdriver clicks the download button, it opens a dialog box in order to ask to Save as, Open or Cancel but I can't click on them. UI logic made on angularJS. After click on button event generation occurs ng-click and call methods which receive file from server.That's why i can't build request to server myself, receive document and save him in necessary directory.

An Ku
  • 1
  • 2

2 Answers2

0

There are generally two ways to tell a browser to automatically download files, without a confirmation prompt.

I am currently not testing with Internext Explorer driver, but I am fairly confident that you must manually configure the browser in its settings tab, telling it NOT to prompt for downloads of a certain type.

Selenium cannot dismiss this type of alert on its own, in a manner similar to a browser alert on the main UI thread.

Some browser drivers, such as Firefox, allow for both setting of this behavior in the browser settings, and from a FirefoxProfile object passed into the driver constructor. Here is an example of how it might be done in firefox:

                FirefoxProfile profile = new FirefoxProfile();
                profile.SetPreference("browser.download.dir", "%path%");
                profile.SetPreference("browser.download.folderList", 2);
                profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/pdf,application/octet-stream,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

This doesn't directly solve your problem, as I don't have the ability to play around with this now to confirm anything, but this should help point you in the right direction.

Asyranok
  • 950
  • 1
  • 7
  • 17
  • I think this way does not fit. I can't must manually configure the browser in its settings tab, telling it NOT to prompt for downloads of a certain type. Because it can influence on other tests running. – An Ku Mar 13 '19 at 11:39
0

IE popup window was controlled by IE native code, we can not call these methods with Selenium. If you want to download file in IE, you may consider other tools, such as Reboot, AutoIT to handle the elements control by IE.
Please refer to these documents:

http://ardesco.lazerycode.com/testing/webdriver/2012/07/25/how-to-download-files-with-selenium-and-why-you-shouldnt.html

Download a file in IE using Selenium

Will Shao - MSFT
  • 1,189
  • 7
  • 14