Skip to content

Commit 5768601

Browse files
authored
[java]: fix return type and docstring for getDownloadableFiles (SeleniumHQ#15293)
1 parent 036be09 commit 5768601

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ public void removeVirtualAuthenticator(VirtualAuthenticator authenticator) {
651651
}
652652

653653
/**
654-
* Retrieves the downloadable files as a map of file names and their corresponding URLs.
654+
* Retrieves the names of the downloadable files.
655655
*
656-
* @return A map containing file names as keys and URLs as values.
656+
* @return A list containing the names of the downloadable files.
657657
* @throws WebDriverException if capability to enable downloads is not set
658658
*/
659659
@Override

java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,21 @@ void noArgConstructorEmptyCapabilitiesTest() {
807807
RemoteWebDriver driver = new RemoteWebDriver() {}; // anonymous subclass
808808
assertThat(driver.getCapabilities()).isEqualTo(new ImmutableCapabilities());
809809
}
810+
811+
@Test
812+
void getDownloadableFilesReturnsType() {
813+
List<String> expectedFiles = Arrays.asList("file1.txt", "file2.pdf");
814+
815+
WebDriverFixture fixture =
816+
new WebDriverFixture(
817+
new ImmutableCapabilities("se:downloadsEnabled", true),
818+
echoCapabilities,
819+
valueResponder(ImmutableMap.of("names", expectedFiles)));
820+
821+
List<String> result = fixture.driver.getDownloadableFiles();
822+
823+
assertThat(result).isInstanceOf(List.class).isEqualTo(expectedFiles);
824+
825+
fixture.verifyCommands(new CommandPayload(DriverCommand.GET_DOWNLOADABLE_FILES, emptyMap()));
826+
}
810827
}

0 commit comments

Comments
 (0)