rockydata 0 Posted February 5, 2015 Report Share Posted February 5, 2015 I'm trying to click a "Download CSV File" button, and then save the resulting file. comment("####### WHEN BUTTON APPEARS, CLICK IT & DOWNLOAD ###########") wait for browser event("Everything Loaded",#CB_MaxWait) if($exists(<name="ctl00$Content$ExportButton$imgExportCSV">)) { then { comment("########## DOWNLOAD FILE #########################") click(<name="ctl00$Content$ExportButton$imgExportCSV">,"Left Click","No") comment("######### SAVE DOWNLOADED FILE ########################") save downloaded file(#FilePathName) } else { } } Sometimes it works great.But often I still get the UBOT "Save As" screen, and it doesn't go away.(The wanted file still seems to get saved in background though). What am I doing wrong, or is there a better way?I'm not a html expert, but it appears that there isn't an url for the file to be downloaded, anywhere in the html code of the website.(Otherwise the "download file" command looks like something I could try out). It feels like a timing issue, where the "save download" internally gets executed either too early or too late after the click.Or should I live with it, and somehow close the unneeded "save as" windows when they appear? Any suggestions will be greatly appreciated! Quote Link to post Share on other sites
gavind 6 Posted February 6, 2015 Report Share Posted February 6, 2015 But often I still get the UBOT "Save As" screen, and it doesn't go away. Just a hunch here. If you get a "Save as" prompt, that would mean that you have a duplicate file name. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted February 7, 2015 Report Share Posted February 7, 2015 Use download file instead of clicking on the button because the button will generally ask you where to save the file. For example if you go here: http://ubotsandbox.com/download-testing.php Then click the element: click(<id="MyZipfile">, "Left Click", "No") The dialog appears, however if you use the download file command: download file($scrape attribute(<id="MyZipfile">, "fullhref"), "{$special folder("Desktop")}/test.zip") You will see that is just saves it without the dialog popup. Quote Link to post Share on other sites
rockydata 0 Posted February 11, 2015 Author Report Share Posted February 11, 2015 Thanks so much for your responses. I will try them out and let you all know. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.