Posted: 7 Nov 2016 16:01 EST Last activity: 6 Nov 2018 20:02 EST
How to download an attachment from WebUrl through windows adapter
I have a requirement to download an attachment from a Web Url in Windows Automation. (When I click a button in my windows application, it will open an URL in a default browser). But am unable to Interrogate the web download window or Save button. Can you please help. Below is the screenshot
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Here is a new implementation for working with the DownloadBar. This solution was written using version 8.0.1080 and uses the latest features of the product at the time. There is a new feature named ClickChildByText which allows you to click options on the DownloadBar by specifying the text on the control.
Have you tried the Save or SaveAs option? This does work with IE 11 on my machine. This exception message is coming out of the Choose script. Try another option (Save or SaveAs) to see if you get the same exception.
if neither of those work, check in interrogation mode to see if the ctlDownloadBar control is created when the download bar is visible.
I have found that the scripts in the attached solution sometimes required me to "hard-code" the option into the script rather than accept it as a parameters. This explains why your new script works with very similar code to the original.
and it works very well for our solution in the development environment (VDI and with full admin right access).
But when we deploy the solution onto the production environment ( non-VDI and with no admin rights), this solution or any other solution provided in this article doesn't work at all, even though all the controls match.
I am attaching the snapshots of all the methods in the script , the automation flow and the message that gets displayed when the download doesnt happen. Also, you would notice, that for debugging purpose I have added message boxes in the 'DonwloadSaveAs' method... but none of these messages get displayed since the 'aeDownloadToolBar' is getting returned as 'Null' .
The same happens with the 'ClickButton' method as well.
Need your advice here and please do let me know if you'd need any more information from my end to give you more clarity on this issue.
If you can do interrogation on a machine that doesn't work you should be able to fix the matching on the aeDownloadToolbar. That would be the first thing to look at and probably will solve your issue.
The scripts use UIAutomation to find the toolbar. You will need a copy of the Windows SDK to troubleshoot them. Once you have that installed you can use the Inspect Objects program to look at the hierarchy and debug the scripts.
You'll need to use a little more C# to actually accomplish this. The line above will get you to the user's download folder. From here you can iterate all of the files and grabbing the latest one. There are many ways to do this of varying complexity, so I'll let you select the one that you understand best.
Thanks for the detailed solution. It works well for me - however, the "Save" button click does not happen if the machine is locked. Is that a limitation with this approach? Any advise on how I can get that to happen even if the machine is locked?
This will not work when the machine is locked. You will need to leave the machine unlocked as the IE Download bar is not actually created by IE while the machine is locked as it knows it doesn't need to create the control because no one is there to use it.
How can I apply this solution without adding a windows form? What I want is that inmediatly after the robot clicks the button that triggers the download, it clicks on the save as button, and allow the robot to specify a name and folder where the file will be downloaded.
I want to download excel from a website. I am using script to download with four method as per thomz code. i am getting popup window, in that i am getting that open,save,close buttons window. In script its giving result false. not able to open,save or save as. Could you please anyone help me in this. Please find the attached screenshot.
Save As is challenging because it is not an option within the control itself, but rather a desktop menu item. The script required to do that would need to locate the desktop first and then find Save As as a child of that. In my experience, Save will cause the file to go to the user's Downloads folder. Since this is a known location, you could then write a script to grab the latest file from here and move it to wherever it needs to go.