0

I am trying to download a file at a desired location using AutoIT, but it is always downloaded in the 'Downloads' folder

AutoIt script :SaveAs.exe

ControlFocus("Save As","","Edit1")
ControlSetText("Save As","","Edit1","F:\Selenium\Projects\images\abc.png")
ControlClick("Save As","","Button1")

I am calling the exe file as

Runtime.getRuntime().exec("src//test//java//autoIT_Scripts//SaveAs.exe");

But, the file is always downloaded in C:\Users\goyalnn\Downloads location

Although, while running the script, I can see that the desired location is populated in the Save As dialog box, but still the file is not downloaded at this location

I have tried to apply Thread.sleep(3000) before calling the SaveAs.exe, but this didn't help

AutomationTester
  • 81
  • 1
  • 1
  • 7
  • 1
    You can try downloading the file without using AutoIT with much ease as follows : Possible duplicate of [Auto-download in firefox browser with java-selenium not working](https://stackoverflow.com/questions/45589571/auto-download-in-firefox-browser-with-java-selenium-not-working) – undetected Selenium Oct 04 '17 at 04:04
  • But I also have to give a specific name to the image and csv files I am downloading. The path and name varies for different testcases. Also, I am using chrome browser, I know how to set the preference to set the download path, but don't know what to do about the filename – AutomationTester Oct 04 '17 at 13:20
  • Also, I realized, the image I am trying to export, always shows the Save As Windows, no matter what are the browser settings, while, it works fine when I am trying to export the table in the form of csv. So, I need to get a solution for handling the SaveAs window, no matter what the browser settings are. I tried using the Robot Class as well, but the issue is, with robot class, 2 testcases cannot be run in parallel, they interfere with each other, as Robot class is nothing but keyboard inputs. – AutomationTester Oct 04 '17 at 14:38

0 Answers0