This is a migrated thread and some comments may be shown as answers.

Handle this dialog how?

25 Answers 377 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Iron
Iron
Iron
David asked on 16 Mar 2021, 04:33 PM

I am using Telerik Test Studio to record automated regression tests for our asp.net web app. We have to support IE11 still. When generating a report you click a continue button and wait several minutes at times for a dialog box to display. I am attaching an image of it. Even though it says Internet Explorer as the title I think it is a Windows Dialog. I need to wait for it to appear, Then click on the open button to cause it to disappear. I can a c# coder so writing a coded step is not an issue but all the samples I have seen so not address this kind of dialog. I have tried the following code but it seems to not find the dialog when it appears.

        [CodedStep(@"New Coded Step")]
        public void SPOT_Deploy_OVR_Rpt_CodedStep()
        {
            GenericDialog SecurityWarningDialog = new GenericDialog(ActiveBrowser, "Internet Explorer", "Open", true);  // Click on the Open button
            Manager.DialogMonitor.AddDialog(SecurityWarningDialog);  

            Manager.DialogMonitor.Start();  

            //Click the link that launches the security dialog
            //ClickLink();
            Manager.Desktop.KeyBoard.KeyPress(Keys.Enter);


            SecurityWarningDialog.WaitUntilHandled(240000);

            Manager.DialogMonitor.Stop();           
        }

 Pardon me for drawing a blue line over the image. It was an accident when I captured it.

Please help!!!!

25 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 17 Mar 2021, 03:00 PM

Hello David,

The dialog from your screenshot looks to be a Download dialog in Internet Explorer and we have built-in steps and coded solution to handle it.

You chose on how to handle this dialog should be automatically recorded, when you record your tests. If you chose to save the file (with the Save as option), you will need to specify the full download path, but you can also cancel the dialog all together.

You can also add a "Handle dialog" step from the Step Builder and configure it for your test scenario. For Download dialogs you can chose the button and where to download the file, as well as how much time it needs to initialize and handle. Please keep in mind that the HandleTimeout is the total time of this step and you need to take into account, if the initialization time is long.

The third option to handle this dialog is in a coded step. The code you used is for generic type of dialog, but the Download dialog is actually a series of dialogs that appear one after the other. We are keeping our product up to date with the latest changes in all supported browsers, so we can support the latest version. The code for handling Download dialogs is in this example. Make sure that you click on the button that opens the dialog, after it has been added to the DialogMonitor is started.

If you experience any troubles with the above suggestions, please let me know and share more details about which approach you took and what is the behavior. We have noticed some inconsistent behavior with Internet Explorer in recent Windows updates (build 19041.746 and above) and we are investigating this further. Please check the build on your end and tell me which one it is.

I hope you will find the above details helpful and automate your test scenario. I remain available to continue our discussion and advise you further.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 17 Mar 2021, 03:06 PM
This dialog is invisible to Test Studio in regards to step builder or otherwise. When I put my pointer over it to add verification of fields it does not show up.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 18 Mar 2021, 02:18 PM
Notice in this screen shot that the dialog can be moved outside of IE. And invoking does nothing nor does the step builder see it in the dom.
0
Plamen Mitrev
Telerik team
answered on 19 Mar 2021, 11:30 AM

Hi David,

The dialog that you are seeing is part of Internet Explorer, but it does not actually exist in the DOM tree of that page. Since Test Studio's highlighting and recording features only interact with the DOM tree of the application, you are not able to record steps against that dialog. That said, we have built-in dialog handling that should add a "Handle Download dialog" step to your test, once you click on the action you want to go for.

If the dialog handling step is not automatically recorder, or you want to add such step outside of the recording session, you can do that from the Step Builder in Test Studio. To do that, open your web test and go to the "Dialogs" section in the Step Builder. Choose the dialog you want to add and click "Add Step". This will add the dialog with default settings and you need to configure it according to your scenario. For download dialogs you need the "HandleButton" and "DownloadPath" (full path and extension where to save the file). You can also adjust the total "HandleTimeout" time and "InitializationTime".

I see that you have tried to handle the dialog with GenericDialog in code. That is why I pointed you to the code example for handling a download dialog. Have you had the chance to try it?

I prepared a sample test against a publicly accessible application. Please add the test to your project, explore the steps and execute it against IE and Chromer to see the behavior. I hope the share details and example will be helpful to you and you can adjust your test. Of course, if you need further assistance let me know and attach the .tstest and .tstest.cs files of you existing web test. They are located in your Test Studio project's folder and have the name of the web test.

I am looking forward to hearing from you.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 01:33 PM

Ok I got what you were saying. I added the download dialog test step and it fails. The dialog is on the screen and it says waiting to handle dialog and it doesn't do anything after that. I tried jacking up the times in the settings as well. So I included the settings for the step and a screen shot of the screen as well.

Thanks for the help.

0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 01:49 PM
I see I had the two timeout values backward so I swapped them so the timeout is 90000 and init time was 250. Still nothing. The dialog is on the screen and the open button is not clicked.
0
Plamen Mitrev
Telerik team
answered on 19 Mar 2021, 01:54 PM

Hi David,

I mentioned before that we are experiencing some inconsistent behavior with download dialogs in Internet Explorer on Windows 10 machine with version 2004 (build 19041.746) and above. The dialog that you see on the screen is the first of series of dialogs related to the download action. Are you, by any chance, using some of the latest Windows 10 builds? What is your exact version and build?

What we noticed on our end is that that dialog is stuck and it is not handled in those version of Windows 10. Our engineering team is currently investigating this issue and is working to resolve it quickly. In the meantime, you can test the "Handle Download dialog" step against different browsers and see how it behaves. What is the result when you lower the InitializationTime to 1000 msec and run the test against Chrome?

Thank you for your cooperation and quick response.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 02:06 PM
Windows 10 Pro 20H2
0
Plamen Mitrev
Telerik team
answered on 19 Mar 2021, 03:15 PM

Hi David,

Version 20H2 (build 19042) that you have is indeed one of the affected versions, where we already recognized an issue with Internet Explorer and the download dialog. We are looking into it with high priority and hope to have it fixed with our next service pack release around the beginning of April. 

In the meantime, you can try running the same test with other browsers, like Chrome, Firefox and Edge Chromium. Those should not have troubles with the download dialogs. Is that the case on your end?

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 04:44 PM

so more bad news. I think you may have even more problems. When I attempt to run any test list with a test that has the download dialog handler step it causes the entire test to not run any steps at all. The test case runner command windows shows that it says  executing  the OVR2 test and then immediately fails. If I uncheck the download dialog step of the test it then executes the test. I have tried deleting the step and re-adding the download dialog step. Even recreated the entire test recording with Chrome. I have set the dialog step settings to Chrome Only as well.

I updated both the dialog updates and the Telerik update this morning. Chrome version is: Version 89.0.4389.90 (Official Build) (64-bit) and Chrome is calibrated.

 

0
Plamen Mitrev
Telerik team
answered on 19 Mar 2021, 05:20 PM

Hi David,

I tried to reproduce the issue you encountered on my end, by running the sample DownloadDialog test that I share with you before. It is running as expected with all browsers, except Internet Explorer. This leads me to believe that this is a different issue and I will need to gather more details from your end. Please follow up on the topics below.

  • What happens when you run the attached sample web test - DownloadDialog? Is that executing successfully on your end? This will help me narrow down if the issue is application/test specific or not.
  • Archive the OVR2.tstest file and attach it to this thread. I will analyze the test steps and their configurations and get familiar with the test scenario.
  • Clear/Enable the Test Studio application log.
  • Execute the OVR2 test from quick execute button and let me know what is the behavior.
  • Gather the generated application log and attach it as .zip file.
  • If there are step failure details on any of the steps, please export them and share them with me. Otherwise, gather the execution log and attach that instead.

The above details will help me narrow down what is causing the test to not even start and I will investigate it further. Please take your time to gather all resources and share them in this thread.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 07:02 PM

OK I replaced the step builder dialog handler with a coded step. By doing that the testlist actually runs the test. then in the coded step I have this:

 

        [CodedStep("New Coded Step")]
        public void OVR2_Handle_Download_CodedStep()
        {
            // Create a save path and file name variable. This will have to be changed for each report
            string save_path;
            // ''' CHANGE THIS PART BELOW FOR EACH REPORT
            save_path = @"C:\Users\david\Downloads";

            // Start dialog monitoring. This starts the coded step
            Manager.DialogMonitor.Start();
            // Handle any unexpected dialog by doing nothing
            Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

            // Create a variable to handle the download dialog, this is a proprietary Telerik object
            DownloadDialogsHandler dialog = new DownloadDialogsHandler(Manager.ActiveBrowser, DialogButton.OPEN, save_path, Manager.Desktop);

            // The continue button is clicked below to intiate the download 
            // CHANGE THIS PART FOR EACH REPORT
            Pages.SynchronizedPredeployment8.ContentPlaceHolder1BtnContinueSubmit.Click(false);


            // Handle the timeout settings for the download of the report in milliseconds; currently this is set to 15 minutes
            dialog.WaitUntilHandled(120000);

            // Stop Dialog Monitoring
            Manager.DialogMonitor.Stop();
        }

 

 

It blows up with an exception the line:  DownloadDialogsHandler dialog = new ............

 

I will work on running the file you sent me. I can't run the test from quick execute as I have a login and reportmain test that has to get the proper state to run ovr2.

 

0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 07:15 PM
Well a break thru. Ran dialogtest you sent me and it works. Change the button from save to open and it FAILS! and in the system log which I have attached it says open of a downloaded file is not supported in Chrome. This is HUGE for us. We need open!
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Mar 2021, 07:22 PM
Ok so I can change it to a save for now but it needs to handle if the files already exists and delete or save over it. How does that work?
0
Plamen Mitrev
Telerik team
answered on 22 Mar 2021, 01:45 PM

Hello David,

Thank you for your follow up on the execution results and your tests. I will share more details about the download dialog.

As you mentioned in your last reply, you have chosen to handle the download dialog with the "Save" option. This will try to save the file on the specified location and if there is a file with that name and extension, you will see an additional dialog that asks to replace it. Test Studio will handle this dialog with the "Yes" option and will save the file over it automatically after several seconds. You only need to ensure that the HandleTimeout does not expire before that happens. You can run the sample test that I provided two times and it will ask you to replace the file and handle it automatically. 

"Save" and "Cancel" options are supported in all browsers, as those are the main use cases of the download dialog. The option to "Open" the file is supported in Edge Chromium and the default application for the file type will be used. Test Studio does not support automation of other applications outside of the current browser and the "Open" option will change the focus to the application, which opened the file. This will cause the next steps to fail during execution. 

I would suggest that you save the file, using the dialog step, and add a coded step to open it and make the necessary verifications or actions. To do that, you will probably need to use external assembly references in your project. We have an example how to write into Excel file, which can be adapted to read from it and verify the content.

I am interested to know what is your exact scenario and what causes the need to open the file during the test execution. What kind of file is it? Do you want to verify the file's content or something else in particular? I will appreciate it if you can elaborate more and we can discuss it further.

Thank you for your cooperation in advance.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 22 Mar 2021, 03:38 PM
I must not have explained it clearly. If I have a step within a Test that has OPEN as the button selection for the dialog and run it on Chrome, the entire TEST (all of it's steps) does not run. If I change the button to SAVE the test runs with all of it's steps.
0
Plamen Mitrev
Telerik team
answered on 23 Mar 2021, 12:10 PM

Hello David,

I got your point and I must say that it is expected to see this behavior with Chrome browser. The "OPEN" action for download dialogs is not supported there, but you can run the same test (with "OPEN") against Edge Chromium browser instead. There this action is supported and you can test it with my sample test or your test against your application.

I am still interested to know more about the test scenario you want to automate and what type of file you want to open. I might be able to provide better guidance, if you share more context and details about the test case.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 23 Mar 2021, 01:38 PM
I am testing report generation. The automated test fills in some report parameters (on screen fields) and then presses a button to generate the reports which are .xls files which I need to visually scan. So my goal was to have each one generate and pop open so I could look at it. I would manually close excel afterward. So I guess I will have to live with save and open them manually. I do have an additional question. Sometimes these report return no data and put that message on the page. It appears that I would have to make a coded step that would look for this message and not abort to the next test or so the download handler if there is data. Is there any code samples like that. Look for text on the page?
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 23 Mar 2021, 02:36 PM
Also my biggest gripe is I can not use the same test multiple times in a test list. E.G. I have a test that checks that all the report links are present. So at the end of each report test it hits a back button to return to that page. I need to run the same test every time to verify the page is correct. Then run the test that tests the specific report. Otherwise I have to repeat the same code steps in every step.
0
Plamen Mitrev
Telerik team
answered on 24 Mar 2021, 02:13 PM

Hello David,

Thank you for sharing more details about your test scenario. It seems that it includes a manual step, where you look through the report's content and I agree that in this case it would be helpful to have the file open directly. However, this is not an automated process and I would like to suggest that you look into this example. The idea is that you can use a coded step to write into an excel file, but in a similar way you can also read from an excel file and verify its content. That can help you get this scenario fully automated.

As per your other question about how to configure your test steps if the report returns no data, I have a codeless suggestion for you. You mentioned that there is a message that appears on the page when there is no data. You can use If->Else logical steps to determine which test steps to be executed in the different scenarios. So, if there is such message on the page, the test will execute the steps in the "If" condition and skip those in the "Else". Otherwise it will be the opposite. Is this something that can help you configure the test?

A single test can only exist once in a test list by design, but you can work around this limitation based on the scenario you want to automate. One of the possible options for you is to move the steps that verify if the page is correct to another test, lets call it "verifyHelpTest". You can create the test and copy->paste the necessary steps directly there. This "verifyHelpTest" can be added as "Test as Step" in all tests that require this verification and at the exact place it has to happen. For example, after clicking the back button, you can call the "verifyHelpTest" as a step to make the verification within the same test's execution.

I hope the above suggestions and information are helpful to you. We can discuss them further, if you have any additional questions.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 24 Mar 2021, 04:11 PM
I like that. How do you end the else if there are common steps following up the if/else block?
0
Plamen Mitrev
Telerik team
answered on 25 Mar 2021, 10:08 AM

Hi David,

The test execution will proceed after the steps in the If or Else block are executed. You choose which steps to include in the If and Else blocks and which steps to leave before and after them depending on your test scenario. 

I prepared a sample test against a public application that checks the random number that is generated. The If block will be executed if the value is 1, otherwise the Else block will be executed. In both cases the test will proceed to execute the steps outside If->Else if there are not failed steps. Please run the attached test on your end several times and explore the execution log.

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 Test Studio course! Check it out at https://learn.telerik.com/.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 25 Mar 2021, 01:21 PM
Ok I got it.
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 25 Mar 2021, 01:21 PM
Thanks for all the help!
0
Plamen Mitrev
Telerik team
answered on 25 Mar 2021, 01:43 PM

I am happy to help, David. Thank you for your cooperation in this discussion.

Let me know if you have any remaining questions and contact us in this or a separate thread.

Have a great day!

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 Test Studio course! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Plamen Mitrev
Telerik team
David
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or