Jump to content
UBot Underground

Click And Download File Problem


Recommended Posts

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!

 

 

 

Link to post
Share on other sites
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. 1.gif

Link to post
Share on other sites

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...