diff --git a/dotnet/src/webdriver/IHasDownloads.cs b/dotnet/src/webdriver/IHasDownloads.cs index 19a2f9982dfb6..e857621495462 100644 --- a/dotnet/src/webdriver/IHasDownloads.cs +++ b/dotnet/src/webdriver/IHasDownloads.cs @@ -28,8 +28,8 @@ public interface IHasDownloads /// /// Retrieves the downloadable files. /// - /// A list of file names available for download. - List GetDownloadableFiles(); + /// A read-only list of file names available for download. + IReadOnlyList GetDownloadableFiles(); /// /// Downloads a file with the specified file name and returns a dictionary containing the downloaded file's data. diff --git a/dotnet/src/webdriver/Remote/RemoteWebDriver.cs b/dotnet/src/webdriver/Remote/RemoteWebDriver.cs index cc8ae20bdaca7..35d0b62ebf3cd 100644 --- a/dotnet/src/webdriver/Remote/RemoteWebDriver.cs +++ b/dotnet/src/webdriver/Remote/RemoteWebDriver.cs @@ -471,10 +471,10 @@ public DevToolsSession GetDevToolsSession(int protocolVersion) } /// - /// Retrieves the downloadable files as a map of file names and their corresponding URLs. + /// Retrieves the downloadable files. /// - /// A list containing file names as keys and URLs as values. - public List GetDownloadableFiles() + /// A read-only list of file names available for download. + public IReadOnlyList GetDownloadableFiles() { var enableDownloads = this.Capabilities.GetCapability(CapabilityType.EnableDownloads); if (enableDownloads == null || !(bool) enableDownloads) { diff --git a/dotnet/test/common/DownloadsTest.cs b/dotnet/test/common/DownloadsTest.cs index 5acecdd7d434e..2597e0a65e3fe 100644 --- a/dotnet/test/common/DownloadsTest.cs +++ b/dotnet/test/common/DownloadsTest.cs @@ -41,7 +41,7 @@ public void CanListDownloadableFiles() { DownloadWithBrowser(); - List names = ((RemoteWebDriver) driver).GetDownloadableFiles(); + IReadOnlyList names = ((RemoteWebDriver) driver).GetDownloadableFiles(); Assert.That(names, Contains.Item("file_1.txt")); Assert.That(names, Contains.Item("file_2.jpg")); } @@ -52,7 +52,7 @@ public void CanDownloadFile() { DownloadWithBrowser(); - List names = ((RemoteWebDriver) driver).GetDownloadableFiles(); + IReadOnlyList names = ((RemoteWebDriver) driver).GetDownloadableFiles(); string fileName = names[0]; string targetDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); @@ -72,7 +72,7 @@ public void CanDeleteFiles() ((RemoteWebDriver)driver).DeleteDownloadableFiles(); - List names = ((RemoteWebDriver) driver).GetDownloadableFiles(); + IReadOnlyList names = ((RemoteWebDriver) driver).GetDownloadableFiles(); Assert.IsEmpty(names, "The names list should be empty."); }