Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created February 28, 2016 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/53124a09a4accd7c8ec5 to your computer and use it in GitHub Desktop.
Save angelovstanton/53124a09a4accd7c8ec5 to your computer and use it in GitHub Desktop.
[TestMethod]
public void VerifyFileDownloadChrome()
{
string expectedFilePath = @"c:\temp\Testing_Framework_2015_3_1314_2_Free.exe";
try
{
String downloadFolderPath = @"c:\temp\";
var options = new ChromeOptions();
options.AddUserProfilePreference("download.default_directory", downloadFolderPath);
driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://www.telerik.com/download-trial-file/v2/telerik-testing-framework");
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until((x) =>
{
return File.Exists(expectedFilePath);
});
FileInfo fileInfo = new FileInfo(expectedFilePath);
long fileSize = fileInfo.Length;
Assert.AreEqual(4326192, fileSize);
}
finally
{
if (File.Exists(expectedFilePath))
{
File.Delete(expectedFilePath);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment