Created
February 28, 2016 19:18
-
-
Save angelovstanton/53124a09a4accd7c8ec5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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