[java] rework downloading files from Grid - #16844
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
|
I'm confused by what you are doing changing this around. We want the same pattern for all the bindings: GET with GET_DOWNLOADED_FILES returns a list of file names that can be downloaded My suggestion elsewhere was to add an optional parameter to the payload for DOWNLOAD_FILE endpoint specifying whether it should come back with base64 or octet-stream and bindings can update to use octet stream handling as desired. That keeps everything backwards compatible and making it easy (one parameter) to update. The pattern for "download all" was to iterate over the list from GET_DOWNLOADED_FIELS. If we want to allow DOWNLOAD_FILE to accept a list, that could work as well, but needs to be backwards compatible. |
f583905 to
d498290
Compare
|
@titusfortner Yes, this PR does exactly what you described:
|
|
I don't understand why the build is failing. I see in logs only this: No reasons why the build failed... :( UPD Seems the build failure was caused by two test files: "file-with-cyrillic-серцеєдність.txt" and "file-with-scandinavian-ø.txt". Looks like Windows build scripts contain some error which don't handle cyrillic/scandinavian characters correctly. Needs to be investigated. By now, I've deleted these two files. |
b0ad278 to
66bb0ba
Compare
* remove the "new" endpoint `GET /se/files/:name` (that was recently added in 4.39.0) * use the "old" endpoint `POST /se/files`, but with optional parameter "format". Possible values are "application/octet-stream" and "application/json" (default). Endpoint `POST /se/files` can respond either in JSON or binary format depending on "format" parameter.
66bb0ba to
dc5d93d
Compare
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
Also, I realized that some symbols (& ' `) are allowed in file name. Browser doesn't replace them with _ when downloading. For Grid, we are waiting for release 4.40.0 with fix SeleniumHQ/selenium#16844
… endpoint (#17982) * [java] remove deprecated GET /session/{sessionId}/se/files/{fileName} endpoint Marked @deprecated in #16844 (Jan 2026) with a note to remove it in Selenium 4.41, 4.42, or 4.43. Trunk is now at 4.49.0-SNAPSHOT, six releases past that target, and none of the four client bindings ever built a request to this path -- they only use the list/POST/DELETE forms of /se/files. * [java] remove now-dead getDownloadedFile(File, String) overload Spotbugs flagged it as an unused private method after the prior commit removed the deprecated GET /se/files/{fileName} endpoint, which was its only caller. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kEM1tVUYCgzyhJ5xmseyF --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
User description
GET /se/files/:name(that was recently added in 4.39.0)POST /se/files, but with optional "format" parameter in payload. Possible values: "application/octet-stream" or "application/json" (default).Endpoint
POST /se/filescan respond either in JSON or binary format depending on the "format" parameter.As a side effect, this PR fixes downloading files with space in name. :)
🔄 Types of changes
PR Type
Bug fix, Enhancement
Description
Remove deprecated
GET /se/files/:nameendpoint, usePOST /se/fileswith Accept headerSupport binary file downloads via Accept: application/octet-stream header
Fix downloading files with special characters (spaces, unicode, etc.)
Add backward compatibility for older Grid versions (4.38.0 and earlier)
Expand test coverage with parameterized tests for various filename types
Diagram Walkthrough
File Walkthrough
2 files
Remove GET endpoint, add binary response supportImplement backward compatibility for file downloads1 files
Remove deprecated GET_DOWNLOADED_FILE command2 files
Add HTTP header support to command specificationsAdd Accept header enum constant5 files
Add parameterized tests for special character filenamesAdd download links for special character test filesAdd test file with scandinavian charactersAdd test file with cyrillic charactersAdd test file with spaces and special characters