-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Feature and motivation
Right now, the suggested solution for downloading files is mounting a volume, but this is not practical when the grid is running as a remote service.
Selenium provides an API for fetching remote files, and this feature had a recent revamp (see: PR SeleniumHQ/selenium#11277 and SeleniumHQ/selenium#11702).
Unfortunately, it seems like nothing of this is implemented in Selenium Docker, the place where this feature is very much needed.
Here are my unsuccessful attempts:
Chrome node
GET /session/:sessionId:/se/files
curl -X GET "http://172.17.53.2:4444/session/98473aa8661fc256bf7c0de98861005e/se/file?filename=100MB.bin"
Result = Unknown command
Firefox node
GET /session/:sessionId:/se/files
curl -X GET "http://172.17.53.2:4444/session/98473aa8661fc256bf7c0de98861005e/se/file?filename=100MB.bin"
Result = Unsupported method - expect POST for file upload
I also tried running this using PHP driver:
$file = $driver->executeCustomCommand('/session/:sessionId/se/file?filename=100MB.bin');Result:
Facebook\WebDriver\Exception\UnknownCommandException : unknown command: unknown command: session/41d161b598c0fd3f85a4e09b1f5f5a1f/se/file?filename=100MB.bin`
This feature is documented, yet cannot be used.
I defined --downloads-path /usr/downloads using env SE_OPTS and nothing. Chrome is still downloading to /home/seluser/Downloads and ignoring the path I defined.
Version: Selenium 4.8.1 (revision 8ebccac989)
Usage example
Calling API like this would return JSON response with base64 encoded file data.
curl -X GET "http://172.17.53.2:4444/session/98473aa8661fc256bf7c0de98861005e/se/file?filename=100MB.bin"
Expected response:
{
"filename": "100MB.bin",
"contents": "ZXhhbXBsZSBiaW5hcnkgZGF0YQ=="
}