You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website_and_docs/content/documentation/grid/configuration/cli_options.en.md
+172-32
Original file line number
Diff line number
Diff line change
@@ -224,7 +224,7 @@ pull request updating this page.
224
224
|`--drain-after-session-count`| int |`1`| Drain and shutdown the Node after X sessions have been executed. Useful for environments like Kubernetes. A value higher than zero enables this feature. |
225
225
|`--hub`| string |`http://localhost:4444`| The address of the Hub in a Hub-and-Node configuration. Can be a hostname or IP address (`hostname`), in which case the Hub will be assumed to be `http://hostname:4444`, the `--grid-url` will be the same `--publish-events` will be `tcp://hostname:4442` and `--subscribe-events` will be `tcp://hostname:4443`. If `hostname` contains a port number, that will be used for `--grid-url` but the URIs for the event bus will remain the same. Any of these default values may be overridden but setting the correct flags. If the hostname has a protocol (such as `https`) that will be used too. |
226
226
|`--enable-cdp`| boolean |`true`| Enable CDP proxying in Grid. A Grid admin can disable CDP if the network doesnot allow websockets. True by default. |
227
-
|`--downloads-path`|string|`/usr/downloads`|The default location wherein all browser triggered file downloads would be available to be retrieved from. This is usually the directory that you configure in your browser as the default location for storing downloaded files. |
227
+
|`--enable-managed-downloads`|boolean|`false`|This causes the Node to auto manage files downloaded for a given session on the Node. |
228
228
|`--selenium-manager`| boolean |`false`| When drivers are not available on the current system, use Selenium Manager. False by default. |
229
229
230
230
### Relay
@@ -352,101 +352,241 @@ driver.quit();
352
352
353
353
Set the custom capability to `false` in order to match the Node B.
354
354
355
-
#### Specifying path from where downloaded files can be retrieved
355
+
#### Enabling Managed downloads by the Node
356
356
357
-
At times a test may need to access files that were downloaded by it on the Node. To retrieve
358
-
such files, following can be done.
357
+
At times a test may need to access files that were downloaded by it on the Node.
358
+
To retrieve such files, following can be done.
359
359
360
360
##### Start the Hub
361
361
```
362
362
java -jar selenium-server-<version>.jar hub
363
363
```
364
364
365
-
##### Start the Node with downloads path specified
365
+
##### Start the Node with manage downloads enabled
* The Grid infrastructure will try to match a session request with `"se:downloadsEnabled"` against ONLY those nodes which were started with `--enable-managed-downloads true`
380
+
* If a session is matched, then the Node automatically sets the required capabilities to let the browser know, as to where should a file be downloaded.
381
+
* The Node now allows a user to:
382
+
* List all the files that were downloaded for a specific session and
383
+
* Retrieve a specific file from the list of files.
384
+
* The directory into which files were downloaded for a specific session gets automatically cleaned up when the session ends (or) timesout due to inactivity.
385
+
386
+
**Note: Currently this capability is ONLY supported on:**
387
+
388
+
*`Edge`
389
+
*`Firefox` and
390
+
*`Chrome` browser
391
+
392
+
##### Listing files that can be downloaded for current session:
393
+
394
+
* The endpoint to `GET` from is `/session/<sessionId>/se/files`.
395
+
* The session needs to be active in order for the command to work.
396
+
* The raw response looks like below:
397
+
398
+
```json
399
+
{
400
+
"value": {
401
+
"names": [
402
+
"Red-blue-green-channel.jpg"
403
+
]
404
+
}
405
+
}
406
+
```
407
+
408
+
In the response the list of file names appear under the key `names`.
409
+
410
+
411
+
##### Dowloading a file:
412
+
413
+
* The endpoint to `POST` from is `/session/<sessionId>/se/files` with a payload of the form `{"name": "fileNameGoesHere}`
372
414
* The session needs to be active in order for the command to work.
*`filename` - Same as what was specified in the request.
427
+
*`filename` - The file name that was downloaded.
375
428
*`contents` - Base64 encoded zipped contents of the file.
376
429
* The file contents are Base64 encoded and they need to be unzipped.
377
430
378
-
##### Sample that retrieves the downloaded file
431
+
##### List files that can be downloaded
432
+
433
+
The below mentioned `curl` example can be used to list all the files that were downloaded by the current session in the Node, and which can be retrieved locally.
379
434
380
-
Assuming the downloaded file is named `my_file.pdf`, and using `curl`, the
435
+
```bash
436
+
curl -X GET "http://localhost:4444/session/90c0149a-2e75-424d-857a-e78734943d4c/se/files"
437
+
```
438
+
439
+
A sample response would look like below:
440
+
441
+
```json
442
+
{
443
+
"value": {
444
+
"names": [
445
+
"Red-blue-green-channel.jpg"
446
+
]
447
+
}
448
+
}
449
+
```
450
+
451
+
##### Retrieve a downloaded file
452
+
453
+
Assuming the downloaded file is named `Red-blue-green-channel.jpg`, and using `curl`, the
381
454
file could be downloaded with the following command:
382
455
383
456
```bash
384
-
curl -X GET "http://localhost:4444/session/<sessionId>/se/file?filename=my_file.pdf"
0 commit comments