Run this piece of code:
The result is:
System.TimeoutException : Timed out waiting '20000' msec. for any dialog to be handled '1'
The file is downloaded, but WaitUntilHandled fails everytime.
If I try to remove call to WaitUntilHandled and call Sleep(20000), all goes fine.
I configured Firefox as described in http://docs.telerik.com/teststudio/user-guide/configure-your-browser/firefox.aspx
but in Firefox 29 was removed the "Show the Downloads window.. " setting.
What is wrong in my code?
[TestFixture]
public
class
TelerikTestingFrameworkTests
{
[Test]
public
void
DownloadAFile()
{
var mySettings =
new
Settings
{
Web =
{
DefaultBrowser = BrowserType.FireFox
},
ExecutionDelay = 1,
UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle
};
var manager =
new
Manager(mySettings);
manager.Start();
manager.LaunchNewBrowser();
manager.DialogMonitor.Start();
var browser = manager.ActiveBrowser;
string
urlForDownload = @
"http://notepad-plus-plus.org/download/v6.5.5.html"
;
browser.NavigateTo(urlForDownload);
HtmlAnchor a = browser.Find.ByExpression<HtmlAnchor>(
"TextContent=Notepad++ Installer"
,
"tagname=a"
);
string
saveLocation = System.IO.Path.Combine(@
"c:\", "
notepadSetup.exe");
File.Delete(saveLocation);
DownloadDialogsHandler handler =
new
DownloadDialogsHandler(browser, DialogButton.SAVE, saveLocation, browser.Desktop);
a.Click();
handler.WaitUntilHandled(20000);
//System.Threading.Thread.Sleep(10000);
File.Exists(saveLocation).Should().BeTrue();
manager.Dispose();
File.Delete(saveLocation);
}
}
The result is:
System.TimeoutException : Timed out waiting '20000' msec. for any dialog to be handled '1'
The file is downloaded, but WaitUntilHandled fails everytime.
If I try to remove call to WaitUntilHandled and call Sleep(20000), all goes fine.
I configured Firefox as described in http://docs.telerik.com/teststudio/user-guide/configure-your-browser/firefox.aspx
but in Firefox 29 was removed the "Show the Downloads window.. " setting.
What is wrong in my code?