Given that with the way Firefox now works, it's somewhat infeasible to specify the Save As filename no matter what kind of link, redirect or mime type watir-webdriver
encounters in a completely non-interactive/non-GUI way.
What might be a simple way to find out the name of the file that's just been saved?
Hopefully something more reliable than "detect latest file created in directory" since I have independent processes necessarily using the same folder simultaneously, including other webdrivers.
Promptless download already setup (as much as possible using many foreseen file types) in profile using this method: Firefox 4 with watir webdriver: Need help using helperApps.neverAsk to save CSV without prompting
In my setup a Bash script calls Ruby which does the watir-webdriver stuff, launches the browser etc. then exits back to the Bash process. I'd prefer if Ruby learned the filename it just saved right away, since with its env it knows best how I want to rename the file, rather than leaving it to some spooky lsof
/strace
to figure out post mortem. But whatever works.
UPDATE
Since the answer seems to be not really, can anyone suggest short Ruby code that finds the latest file saved given a directory, checks if indeed it was written within the last 2 seconds, and renames it to my variable $acctno
.csv ?