Question
Accenture
IN
Last activity: 16 Oct 2018 12:03 EDT
How to automate download of a file in internet explorer using Pega Robotic Studio 8 (Openspan)
When we click on file download- we get a popup in Internet Explorer with options as Open, Save or Cancel. How to automate clicking on either of these buttons, as we are not able to inspect these buttons via start interrogation feature.
**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.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Have you tried interrogating these buttons? If they are the ones I think they are, then you can simply interrogate them and call PerformClick. Are you able to post a screenshot of the buttons?
As an aside, I would suggest you almost always perform a save versus a save as. This presents less steps to automate and calling save will always place files in a known location and handle duplicates automatically. You can then move the file to wherever you need it to be and rename it in the process as needed.
Synechron Technologies Pvt. Ltd.
IN
I faced similar situation. Here is what I did...
You can interrogate the Notification Bar, but it will give you parent controls and not the individual buttons. There are 2 ways to automate the download.
1. you can send %s key to parent control using SendKeys functions, it saves the downloaded by to default download folder. You can use Hide method of controls to hide the notification bar if you want. You need to give some pause once you send the key.
2. You can interrogate the notification bar and add control region and define region for save button and close (X) icon. You can perform clicks on these regions to automate the notification bar in IE. To enable control region related function its better to make changes in OpenSpan.ini which is at C:\Program Files (x86)\OpenSpan\OpenSpan Studio for Microsoft Visual Studio 2015\openspan.ini. Search [GDI] section, make Enabled=1, make AllProcesses=1. Then you can read the text message on notification bar to identify whether notification is for 'Do you want to open or save..?' or '...download has completed.' message.
Attached some screenshots for help. Let me know if it helps, or the way you did.
Thanks,
Pravin Pujari
I faced similar situation. Here is what I did...
You can interrogate the Notification Bar, but it will give you parent controls and not the individual buttons. There are 2 ways to automate the download.
1. you can send %s key to parent control using SendKeys functions, it saves the downloaded by to default download folder. You can use Hide method of controls to hide the notification bar if you want. You need to give some pause once you send the key.
2. You can interrogate the notification bar and add control region and define region for save button and close (X) icon. You can perform clicks on these regions to automate the notification bar in IE. To enable control region related function its better to make changes in OpenSpan.ini which is at C:\Program Files (x86)\OpenSpan\OpenSpan Studio for Microsoft Visual Studio 2015\openspan.ini. Search [GDI] section, make Enabled=1, make AllProcesses=1. Then you can read the text message on notification bar to identify whether notification is for 'Do you want to open or save..?' or '...download has completed.' message.
Attached some screenshots for help. Let me know if it helps, or the way you did.
Thanks,
Pravin Pujari
-
Darija Sokolova
Accenture
NL
Hi,
I have used the control region method to download file in IE.But Iam not able to perform click on the control region selected even after changing enable=1 and allprocess=1 in openspan.ini.Can you please post screenshots of the automation.
Thanks,
koushik.
Pegasystems Inc.
US
The best way to download a file is to follow the thread at the URL below. Essentially, you interrogate the download bar control and pass it into a script to interact with the buttons.
https://collaborate.pega.com/question/how-download-attachment-weburl-through-windows-adapter
Bank of America
IN
Thanks Pravin, its working
Anthem
US
Hi,
I have encountered the same problem. However, we were able to perform the opening the downloaded file automation without using the Add control region interrogation method using script.
Hope this helps.
Script:
Parameters: OpenSpan.Adapters.Controls.Control control, int pauseDuration, string choice, out string message
Method Body:
Diagnostic.TraceVerbose("Script", string.Format("Choose script running, Choice: {0}", choice)); switch (choice) { case "Open": return ClickButton(control, pauseDuration, "Open", out message); case "Save": return ClickButton(control, pauseDuration, "Save", out message); case "Save As": return DownloadSaveAs(control, pauseDuration, out message); case "Show all content": return ClickButton(control, pauseDuration, "Show all content", out message); } message = "invalid option"; Diagnostic.TraceVerbose("Script", string.Format("Choose script complete, Message: {0}, Result: FALSE", message)); return false;
Accenture
IN
hi,
can you specify the .dlls used in the script
Pegasystems Inc.
US
I am attaching a screenshot of the references added.
Boubyan Bank
KW
hi Vijay,
i am struck with the download/save as pop-up ,
can u plesae specify, how to do this , how to use the script that u specified.
thanks in advance!!!
bhawani.
Pegasystems Inc.
IN
Hi,
Thank you for posting your query in the PSC. This looks like an inactive post and hence, we suggest you create a new post for your query. Click on the Write a Post button that’s available on the top right pane of this page. Once created, please reply back here with the URL of the new post.
You may also refer this discussion link as a reference in the new thread.
PwC
IT
Hi Pravin,
could you tell me wich is the command to "Save as" instead of "Save" (%s)?
tks
Corrado
Capgemini Technology Services India Limited
IN
Name: GetWindowHandle
Input Parameters: OpenSpan.Adapters.Controls.Control control1
Output Parameters: IntPtr
Name: GetWindowHandle
Input Parameters: OpenSpan.Adapters.Controls.Control control1
Output Parameters: IntPtr
Method Body:
OpenSpan.Adapters.Windows.Window targetWindow = control1.Target as OpenSpan.Adapters.Windows.Window;
if(targetWindow != null)
{
return targetWindow.Handle;
}
return IntPtr.Zero;
-
Nagaraju Nalla Nagaraj Nalla