Created
February 28, 2016 19:19
-
-
Save angelovstanton/da40aa1c5e4b4050c9a0 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 VerifyFileDownloadFirefox() | |
{ | |
string expectedFilePath = @"c:\temp\Testing_Framework_2015_3_1314_2_Free.exe"; | |
try | |
{ | |
String downloadFolderPath = @"c:\temp\"; | |
FirefoxProfile profile = new FirefoxProfile(); | |
profile.SetPreference("browser.download.folderList", 2); | |
profile.SetPreference("browser.download.dir", downloadFolderPath); | |
profile.SetPreference("browser.download.manager.alertOnEXEOpen", false); | |
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword, application/binary, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream"); | |
this.driver = new FirefoxDriver(profile); | |
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