Hi,
I was wondering if it is possible to set the location that the file download handle dialog downloads to?
I am aware that I could just set the location through the browser.
The hope is that we will be able to implement a coded step to open the downloaded file from a date specific folder for each time a test list is run. Thus run the coded step against a new set of downloads without having to manually change the download location for each browser before each test.
Any help would be greatly appreciated.
Thanks
Tom
5 Answers, 1 is accepted
There are two possible ways to achieve the effect you want:
1) Data bind the Handle Download Dialog test step. Update the data before running the test to point to a different folder (which could be done via a coded step).
2) Implement the Handle Download Dialog completely in code such that the code would get the current date and plug it into the file location to save to.
Regards,
Cody
Telerik
Thanks for replying Cody.
I'm new to testing and test studio so this is probably human error rather than a .dll issue:
I'm trying to implement the download dialog completely in code as you suggest.
However I can't get the test to run. I keep getting the following compiling error;
'ArtOfTest.WebAii.ObjectModel.Element' does not contain a definition for 'Click'
As I said I'm guessing this is just me misunderstanding ​how to implement a coded download step but any help or direction would be appreciated.
Thank You
Tom
I'll be happy to assist, but I need to see your code so I can diagnose what is causing the compile error and help you fix it. Please send me your entire code file for review. Put it into a .zip file and attach that .zip file here.
Regards,
Cody
Telerik
Thanks you Cody,
I've attached the tstest.cs as requested.
It is the only coded step in this test currently and pretty much mirrors the example.
Thanks Tom
There are two problems:
1) The was not closed
public void DownloadFileTo()
{
with a closing brace
}
2) In this line Element.Click(false); Element is an undefined object. You must first locate the correct element to click on that will trigger the download dialog. You do this using one of the many Find.Byxxx methods available. For example:
HtmlButton downloadLink = ActiveBrowser.Find.ById<HtmlButton>("download");
downloadLink.Click(false);
You need to study the DOM to figure out what is the correct find expression for locating the right button.
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Linq;
using
ArtOfTest.Common.UnitTesting;
using
ArtOfTest.WebAii.Core;
using
ArtOfTest.WebAii.Controls.HtmlControls;
using
ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using
ArtOfTest.WebAii.Design;
using
ArtOfTest.WebAii.Design.Execution;
using
ArtOfTest.WebAii.ObjectModel;
using
ArtOfTest.WebAii.Silverlight;
using
ArtOfTest.WebAii.Silverlight.UI;
using
ArtOfTest.WebAii.Win32.Dialogs;
using
Telerik.TestingFramework.Controls.KendoUI;
using
Telerik.WebAii.Controls.Html;
using
Telerik.WebAii.Controls.Xaml;
namespace
TestExamplesProject
{
public
class
WebTest1 : BaseWebAiiTest
{
#region [ Dynamic Pages Reference ]
private
Pages _pages;
/// <summary>
/// Gets the Pages object that has references
/// to all the elements, frames or regions
/// in this project.
/// </summary>
public
Pages Pages
{
get
{
if
(_pages ==
null
)
{
_pages =
new
Pages(Manager.Current);
}
return
_pages;
}
}
#endregion
[CodedStep(@
"DownloadFileTo"
)]
public
void
DownloadFileTo()
{
//still need to inset datetime into file save
DownloadDialogsHandler dialog =
new
DownloadDialogsHandler(Manager.ActiveBrowser, DialogButton.SAVE, @
"C:\User\Tom\Documents\"
, Manager.Desktop);
Manager.DialogMonitor.Start();
// does this need to be browser specific aswell as module specific?
//which element to trigger the dialog?
Element.Click(
false
);
dialog.WaitUntilHandled(30000);
}
// Add your test methods here...
}
}
Regards,
Cody
Telerik