9 Answers, 1 is accepted
Hello Jessica,
The Handle 'Download' dialog step comes with some configuration and properties that allow you to change the DownloadPath (see downloadPath.png). It needs to be a full path and file name, where you want to save the file. Please expand the step itself and check the Properties pane for more details on the available configurations.
When the test completes the execution of the Handle 'Download' dialog step and it is successfully saved, the step will be marked as passed. You can create a coded step, which double checks if the file actually exists in the specified location after that.
I hope the above details will be helpful to you. Please do not hesitate to contact us again, if you need further assistance.
Regards,
Plamen Mitrev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hello Plamen,
My apologies I think I didn't clarify correctly what I was trying to do. I wanted to just verify what the filename was set to in the download dialog. I don't actually want to download the file. My goal in the test is to verify the filename pre-set in the download dialog matches the filename. I hope that makes sense.
Thanks,
Jessica
Hi Jessica,
Thank you for sharing additional details about the test scenario.
The file location that shows in the download dialog is either a browser preference in the configuration, or the last folder, where you saved files on that machine. As you mentioned, you are interested in getting the filename that is originally used for the download. This filename should be available in the element's attributes and you can add an advanced verification for that in the Recorder toolbar. Please follow the steps below and the details in the linked article.
- Navigate to the page with the download link with the Test Studio recorder attached.
- Use the Highlight Element feature to manually build a step against the download link or button.
- Go to Verifications tab in the Recorder toolbar and select Attributes.
- Find the attribute that contains the filename and create a verification step for that attribute, using "contains" and the expected filename.
- That filename should be also set in the download dialog.
The above steps should help you get the filename from the DOM tree of the page, since there is no functionality to verify that in the download dialog itself. Please check the attached sample web test for reference and let me know if you have some follow up questions.
Thank you for your understanding and cooperation.
Regards,
Plamen Mitrev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Plamen,
Thank you for the additional information. I looked into the href and unfortunately it doesn't include the filename. I did figure out that the filename is supplied on an HTTP Response Header, but I don't know how to test that in Test Studio as a web test. I'm guessing that the best thing to do is download the file and verify the filename and then delete the file at the end of the run?
Thanks,
Jessica
Hi Jessica,
As you mentioned, the filename is not available in the DOM tree and it is not possible to get it and verify it, unless you click the download button and check the value in the download dialog. If you handle this dialog in a Handle Download dialog step, Test Studio will overwrite the filename value with the DownloadPath that is configured for the dialog step. This means that the original filename will be lost.
I prepared a sample project with a web test that navigates to a web page and gets the filename, without executing the Handle Download dialog step. Almost everything happens in code, but you can use that code for Internet Explorer and Chrome browsers. Other browsers will have slightly different behavior and might need some adjustments. Please analyze the attached project and check my notes below on what happens during execution.
- I don't use the out of the box dialog handled that will handle and save the file. I configured custom dialog handlers based on the browser type.
- When the dialogs are created, I make sure that the DialogMonitor is started, before clicking the button that will open up the download dialog.
- There is a 5 second execution delay that should give enough time for the custom dialog handled to copy the filename and set it in global variable. You can increase that delay, if needed.
- Since we don't need to download the file, I close the dialog and remove it from the dialog collection, so it does not interfere with some other steps in the test.
Please run the test in the attached project and see if that is the behavior you want to achieve. It is somewhat complex and requires custom implementation, but it should get you the original filename.
I remain available to advise you further and continue our discussion.
Regards,
Plamen Mitrev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Jessica,
I am happy to know that the sample project and suggestions were helpful. Do not hesitate to contact us again, if you have any questions related to Test Studio.
Wish you a great weekend.
Regards,
Plamen Mitrev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hello again,
I wanted to reach out and ask if there has been any bugs reported with Test Studio or changes to the latest version of Edge Chromium and IE 11. I have recalibrated my browsers in Test Studio, made sure the dialog handlers are up to date, but I am not seeing the Save As button clicked with the above code when ran in IE, thus it doesn't get the file path in the download dialog. In Edge Chromium despite adding the dialog to the dialog monitor it responds to the download prompt as an unexpected dialog and thus does nothing. It does prompt the user in a ribbon at the bottom to Cancel or Save As, but like in IE the Save As button is not clicked to bring up the download dialog.
The code does run fine on Chrome.
Attached is the log for a run on Edge Chromium and IE
Thanks,
Jessica
Hi Jessica,
I retested the Download Dialog Handle with Test Studio across all supported browsers and it turns out that there has been a major change in how Edge Chromium's latest versions are handling the download now. This changes was recently introduces in the last couple of weeks and we will investigate it further on our end. We aim to apply a solution in the upcoming release in November, or with a Service Pack update after that. For the meantime, you can downgrade Edge Chromium browser to previous version (85.0.564.63 and older) as a temporary solution.
My investigation did not show issues with the rest of the browsers, like IE as you mentioned. I am using version 11.1304.17134.0 and was able to record and execute a test against a publicly accessible application. Please find this test attached to this reply and run it on your end. If that works for you, we need to investigate the application under test and your web test against it in more details. Please follow up on the topics below.
- A sample Test Studio project with all necessary tests to handle the download dialog.
- Provide temporary access to the application under test. That way I can explore it on my end and troubleshoot it.
- What is you exact IE version?
You can open a private support ticket to provide the above mentioned resources, if you are not comfortable sharing such information publicly.
I am looking forward to hearing from you and continue our discussion.
Regards,
Plamen Mitrev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.