private void ReturnedFileDownload(IBrowserWrapper browser, string fileContent) { browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ReturnedFile_ReturnedFileSample); var jsexec = browser.GetJavaScriptExecutor(); jsexec.ExecuteScript("window.downloadURL = \"\";"); jsexec.ExecuteScript("DotVVM.prototype.performRedirect = function(url){window.downloadURL = url};"); browser.First("textarea").SendKeys(fileContent); browser.First("input").SendKeys(Keys.Enter); var downloadURL = (string)jsexec.ExecuteScript("return window.downloadURL;"); Assert.IsNotNull(downloadURL); string returnedFile; using (var client = new WebClient()) { returnedFile = client.DownloadString(browser.GetAbsoluteUrl(downloadURL)); } Assert.AreEqual(fileContent, returnedFile); }