Hi,
I am trying to implement SaveAsDialog class in my coded step and receive this compilation error:
[ Compiler ] error CS1729: 'ArtOfTest.WebAii.Win32.Dialogs.SaveAsDialog' does not contain a constructor that takes 4 arguments 12:22:14 'INFO' > Build Failed
This is weird, as I follow the documentation here for the class. How is it possible that now the compilation error here show the constructor does not take in 4 arguments?
Following is the code I have written:
SaveAsDialog dialog = new SaveAsDialog (Manager.ActiveBrowser, DialogButton.SAVE , @filepath, Manager.Desktop);
Manager.DialogMonitor.Start();
dialog.SaveFileName = filename;
dialog.WaitUntilHandled(30000);
Anyone can help?
Thanks in advance.
1 Answer, 1 is accepted
Hi Yan Jun,
The arguments for a constructor are separated with commas (,) in the brackets. It seems that you have mistyped the first argument in declaring the new dialog and inserted a comma instead of full stop between Manager.ActiveBrowser and DialogButton.Save. This is how the compiler reads it as there are 4 arguments listed.
I hope this helps you fix the error. Let me know if you need further assistance.
Regards,
Elena
Progress Telerik
An Automation Strategy That Delivers: Testing Telerik & Kendo UI
Do you get a headache every time your automation tool doesn’t get your UI? No need to reach for the painkillers just yet! Our teammates are going LIVE for a webinar on the topic on Wed, Oct 20, at 11 am ET! Save your seat: https://prgress.co/3FmS8l4
Hi Elena,
Thanks for the prompt reply.
I don't quite understand what you mean by I mistyped a declaration with comma instead of full stop.
I have followed the similar type of declaration taught here in the documentation, and adapted to SaveAsDialog class.
Can you please further explain on your point of comma and full stop based on the example provided in the documentation above?
Also, if you refer to the documentation here, actually the SaveAsDialog constructor is supposed to have 4 arguments. Why is it the error in compilation is that it cannot take in 4 arguments?
Thank you.
Hi Yan Jun,
Thanks for following this up. With these latest details I see where the confusion comes from.
The SaveAs dialog handler as per Test Studio definitions is the handler to handle the WPF download file dialog. And as listed in the example it requires three arguments only.
If you need to define a download dialog handler for an HTML application, you need to use the example you referred here. And this is the dialog handler, which takes 4 arguments as you have listed them. This handler will always handle the download dialog through the Save As button regardless of where this is listed in the dialog (as these are different for each browser).
Please, let me know if this information helps you sort out the confusion and if you managed to adjust the coded step to handle the dialog.
Hi Elene,
Thanks for getting back so soon and the explanation.
I have tried out the suggested coded step with File Download handler, however I keep facing this timeout error although the download has already been handled. Then I tried to add new Test Step - Handle File Download. Same issue happens as well.
I have attached a recording of the execution and we can clearly see that the file has been successfully downloaded to defined path with specified file name., but the execution still stop at Handle Download Dialog step, same for the coded step.
I also attach here the execution logs for both the coded step file download handling and added test step "Handle File Download". Both ways throw the same error saying time out. Also attached the coded step written.
Please do kindly advise.
Thank you
Hi Yan Jun,
Thanks for providing these additional details.
Based on these the issue with the Download dialog seems to be related to the latest update of the Chrome browser and how dialogs should be handled in it. Often the browsers change how the dialog behaves and thus the Test Studio handlers stop working.
To fix this misbehavior, there is an update in Test Studio pushed on demand for supporting the latest changes in the browser - please, find details for this update in this article.
From the video you shared, I noticed that there is a mark for this update in your Test Studio. Can you take the time to upgrade the dialog handlers and then check if the download dialog step will be executed successfully.
Let me know if there is any further issue on your end.
Hi Elena,
Thanks for the explanation and the update reminder.
I have done the update in the browser settings and the handle dialog seems to be working now.
However, the results is not always consistent though. Sometimes it passed, sometimes it fails.
Is this behaviour expected?
Please kindly advise.
Thank you.
Hi Yan Jun,
I am glad to know that the update did the trick and the dialog is now handled correctly.
As to the consistency of its execution, you might need to increase the HandleTimeout property for the step. If the file to download is larger, or its size is different for each test run, or the network communication stability varies, it might take different time for the download to be proceeded.
The other timeout you can increase is the InitializationTime - it is used to wait for the dialog to appear on screen.
No matter how large timeout you set for both properties, these will wait only until the dilaog appears, or is handled.
I hope that this will improve the execution consistency for the download handling. If still having troubles, let me know further details what these are.
Regards,
Elena
Hi Elena,
After trying to adjust on initialization time and handle timeout, it appears that the error still persists, although the files are successfully downloaded and named accordingly.
Is it because this is affected by the download process on my AUT? Actually, the file download in my system will not prompt out any dialog for handling but to directly download the file with default naming into the "Downloads" folder, if this is performed manually.
However, I notice that if I added the "Handle Download Dialog" test step into the execution, now then I will be able to rename the file and set specific location for the file download during the test case execution. I have been doing this for the other auto download process for my AUT.
Is this why, somehow the download dialog does not seem to be handled at all, because the file download originally is meant to be using the default naming and to be directly put to "Downloads" folder, the AUT does not have any download dialog to be handled to begin with?
But why is download dialog is still prompted and somehow handled as intended, after I added the test step "Handle Download Dialog"?
Please kindly advise.
Thank you very much
Hi Yan Jun,
One of the prerequisites for Test Studio to interact correctly with the browsers is their calibration. These are a set of settings applied so that the browser acts as we expect it to.
These settings include how the dialogs and popups should be handled including the Download dialog. Since this consists of a sequence of few dialogs, it is really important that the related settings are configured correctly on each machine, which will be used for Test Studio test development and execution - Always ask where to save the downloaded file.
Based on the observed behavior, I can recommend you to check if the browsers are calibrated on all machines you work on. The settings for your local machine are in the project settings under Browsers section and it can be accessed also through the Test ribbon.
If you need to check this on any execution machine, which is part of the Test Studio Scheduling, you can access it through the Execution status view. To open any machine details double click it from the list.
Otherwise, you can login to the machine, start the Execution client and use the buttons in the Browsers section.
I hope that this will sort out any issues you might have with Test Studio on the execution machine.
Thank you for your cooperation once again.
Regards,
Elena
Hi Elena,
Thanks for the reminder on calibration. Actually all these times I have always enabled the auto calibration settings in Test List and as well as always calibrate the browser at project level.
However, none of this is helping with the situation actually. I am still getting failed test results from the handle download dialog.
Thank you
Hi Yan Jun,
Let me get back few steps in this conversation.
You are saying that when you want to download a file, it gets automatically downloaded in the Downloads folder set in the browser. And this is the behavior when using the browser outside of Test Studio, or in the context of a recording/execution session.
If this is so, then the calibration of this browser is not correctly set - it could be reported as calibrated, but something specific in the machine policies might not allow Test Studio to change the setting related to the file download behavior.
However, it is mandatory for Test Studio tests, that the browser always asks where to save the file and brings up the actual download dialog. Otherwise, there is no way for Test Studio to detect the automatic download. Thus the Handle download dialog step will fail as there is no dialog to be handled.
So. you can open the settings of the browser and check what are the download settings. You can find all Test Studio related settings listed in this article - open the Manual Configuration section at the bottom of the page. (The provided article is for Chrome browser. If you need any of the other browsers, there is the same section in each separate browser article).
If these settings are correct and you still encounter issues with the download dialog on specific machine, please, take the time to record a video of the test run with enabled annotations. This way I will be able to see what might be going wrong.
Thank you for your cooperation once again.
Regards,
Elena
Hi Elena,
I have carefully read and followed your suggestions above.
Please find my reply has attachments for the execution log as well as the application log. Please do let me know or provide me another storage space for the video recording as the size of the compressed video is huge and cannot be uploaded.
As you see in the video and results, I have calibrated the browser, but some of the handle dialog still fails due to time out while others passed. Nonetheless, all the files have been downloaded successfully in the right place.
Please do kindly advise this inconsistency after you have help analyzed the provided details.
Thank you.
Hi Elena,
As I try to re-execute the test case to see if the results are consistent. Here again, I found all the dialog handling in the test case failed. The results are really not consistent on my side.
I have attached the 2nd time execution for logs for reference as well.
Please do advise.
Thank you.
Hi Yan Jun,
Probably the videos you wanted to upload were too large, or were not zipped. So these were not attached to your posts. Can you, please, use this cloud folder to upload these?
On top of this, open your Chrome browser on the machine where the tests fail to handle a dialog and paste in the address bar chrome://settings/downloads. Please, ensure that the second option Ask where to save each file before downloading is enabled. You can take a screenshot of this just to keep track of everything we discuss in this conversation.
Thank you for your time in advance.
Hi Elena,
Thanks for your prompt reply.
Please find that I have already uploaded the video into the provided drive.
Also please find in the attachment is the screenshot of the download setting which already enabled.
Thank you.
Hi Yan Jun,
Thanks for sharing the video of the test execution. This is really helpful for me to sort out the issue.
To better understand the inconsistent behavior, there are few specifics of the download dialog and how this is handled in Test Studio, which needs to be mentioned.
- The download file handling is a sequence of dialogs detected and handled within the terms of the 'Handle download' step in Test Studio.
- Once the Save As dialog, in which you enter the folder and name of the file, appears, the download will continue and will actually download the file, despite of what is reported in the step execution (passed or failed).
- If the time set in the HandleTimeout of the step is insufficient to handle all of these dialogs, the step fails and the rest of the dialogs in the sequence will be considered as unexpected dialogs.
So, what happens on your end is that the download dialogs seem to be handled correctly - the files are downloaded, the dialog is dismissed, etc. However, the test step is set to wait for 30 seconds for the dialog to be handled. And when these are over and there is no message from that the dialog is handled, the execution process reports this failed.
That said, you will need to increase the HandleTimeout for all of the download dialogs. All these take close to 30 seconds, or even more time to enter the file full path text and to actually download the file. TO ensure that you will face no false failures, you can set the HandleTimeout to 2 minutes (120000msec). If you have any concerns for the amount of time, you should consider that this timeout will not slow down the test execution dramatically. It only allows sufficient time for the download to complete and be detected from Test Studio, but will be only waited if the download action needs that much time.
Please, revise all of the handle dialog steps across your project and increase the timeouts for handling the dialogs. Then, observe for some time the test runs and let me know if they get consistent.
Thank you once again for all your time and cooperation.
Regard,
Elena
Hi Elena,
Thanks for the detailed explanation. Based on your suggestion, I have tried 2 ways:
1. All dialog handling timeout changed to 120000ms. Result - Half of the test cases failed on the dialog handling while the other passed.
2. 50% of the dialog handling timeout remains 120000ms while the other half is changed to 180000ms, due to only half of the test cases failed the dialog handling earlier in the 1st trial, thinking it might need more time
However, in the 2nd trial, all test cases now failed the dialog handling.
Please kindly refer to the attachments for execution logs and application logs for both of the trials.
I have uploaded the latest recordings for both of the trials as well to the cloud folder you have provided earlier.
Please do kindly advise.
Thank you.
Hi Yan Yun,
Can you set the InitializationTimeout to 60000 msec and then check how consistent will be the test run?
Please, keep me updated on your observations. Thank you for your cooperation.
Hi Elena,
Based on your suggestion, I have adjusted the initialization time accordingly.
Regrettably, the results are still failed. I executed few more times to ensure it is really failing still.
Please find in the attachment are the logs for the execution. Recording for the execution, as per usual, uploaded in the cloud drive provided earlier.
Thank you.
Hi Yan Yun,
Thanks for the additional resource to continue the investigation. I revised all videos and logs once again and there is another assumption to share about the inconsistent behavior you observe.
All download dialog steps store the files into a network location - I am not sure what is the reason for this, but my point is that this might be causing the issues with the dialogs. Can you, please, take the time to test the following steps?
- Set the InitializationTimeout back to 500 ms.
- Set the HandleTimeout to 60 000 ms.
- Change the download location for each step with a folder on your local computer.
- Execute the test that way and let me know of the outcome.
In addition you can elaborate on the network location (is this drive on another machine, actually) and what is the requirement to store the files on that remote drive.
I appreciate your time and cooperation in this case.
Hi Elena,
After changing the download location to local folder as per your suggestion, all the test cases have finally passed.
We are saving the downloaded files into the network folder so that the files are accessible to everyone, especially the development team, if the content of the downloaded files are found error in it.
That's why we save the downloaded files into a network location where the manual test cases and test data are located as well because these artefacts where expected to store together for easier reference.
The network location is not on any local machine drive, it's another server.
May I please ask, then how are we to proceed with this issue, since the dialog handling cannot be properly handled when the storage location is on a remote server? We have no choice but to save it to a local storage?
Please do kindly advise.
Thank you.
Hi Yan Jun,
Thanks for getting back to me with these details. It seems that the time set on the remote machine, where the shared drive is, differs from that on your local machine. This is how the check from Test Studio side, if the downloaded is finished, fails and causes the Handle Download DIalog step to be marked as failed.
Since you need to transfer the downloaded files to that remote machine, I will suggest you add a coded step at the end of the test, which copies the files to the desired location. Here is the Microsoft docs how to use the classes from the System.IO namespace to copy, move, delete files, etc.
Please, take the time to test this on your end and let me know if that works for you.
Thank you for your continuous cooperation once again!
Regards,
Elena
Hi Elena,
Thanks for your suggestion. I shall proceed to try out the method and get back to you.
However, may I please ask further more clarifications on your explanation here:
"It seems that the time set on the remote machine, where the shared drive is, differs from that on your local machine. This is how the check from Test Studio side, if the downloaded is finished, fails and causes the Handle Download Dialog step to be marked as failed."
I do not quite understand what is this "time set" you are talking about. Can you please clarify further?
Thank you.
Hi Yan Jun,
Test Studio uses a check of some time stamps in the downloading file to determine whether the download is finished or is still in process. If the machine time, which is set on the machine, where the remote drive is, and which is set on the machine from which the test is executed, differ, the Handle download dialog step may not identify that the download action is completed. This difference might be even of some seconds, or miliseconds, but still it causes this internal check to fail, which causes the overall step to fail.
I hope this brings you the missing piece of information. Let me know if you still have any doubts on the topic.
Thank you for your time!
Regards,
Elena
Hi Elena,
Thanks for your clarification. Will you be able to find out what exactly are those timestamps Test Studio is using? So that on my side will be able to check further if we are able to solve this issue by synching the time?
This is asked because I have tried your proposed System IO solution earlier and faced the following error:
Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: 'Move File from one folder to another folder'.
InnerException:
System.IO.IOException: Source and destination path must have identical roots. Move will not work across volumes.
I don't think the proposed moving files through system IO solution is possible on my side at the moment.
Please do kindly further advise.
Thank you.
Hi Yan Yun,
The timestamps I mentioned are internal checks in Test Studio defined for the action to handle the download dialog. If the shared drive is on a remote machine, there always could be some difference in the time on the machines.
Therefore I recommend to stick to the workaround with the coded step to copy the files to the remote drive.
I checked the error you listed and it seems that you are using the Move() method, which cannot be used when moving files to a different drive. Instead, it is recommended to use Copy() and, optionally, delete the files into the local directory.
I found some further examples on the web demonstrating how to handle similar scenario in C# - please, check this StackOverflow discussion. It uses the .Net framework File class, the Directory class and also FileInfo class.
Please, try to adjust the code accordingly and let me know if that works for you.
Thank you for you cooperation once again.
Regards,
Elena