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
| SE_SCREEN_WIDTH | 1920 | Use in Node to set the screen width ||
4
4
| SE_SCREEN_HEIGHT | 1080 | Use in Node to set the screen height ||
5
-
| SE_VIDEO_FILE_NAME |auto| Use in function video recording to set the output file name. Set `auto` for dynamic file name relying on test metadata ||
5
+
| SE_VIDEO_FILE_NAME |video.mp4| Use in function video recording to set the output file name. Set `auto` for dynamic file name relying on test metadata ||
6
6
| SE_FRAME_RATE | 15 | Set the frame rate for FFmpeg in video recording ||
7
7
| SE_CODEC | libx264 | Set the codec for FFmpeg in video recording ||
8
8
| SE_PRESET | -preset ultrafast | Set the preset for FFmpeg in video recording ||
9
-
| SE_VIDEO_UPLOAD_ENABLED | false |Enable video upload ||
9
+
| SE_VIDEO_UPLOAD_ENABLED | false |Deprecated in event-driven mode (`video_service.py`); upload enablement is now derived from non-empty `SE_UPLOAD_DESTINATION_PREFIX`||
10
10
| SE_VIDEO_INTERNAL_UPLOAD | true | Enable video upload using Rclone in the same recorder container ||
11
11
| SE_UPLOAD_DESTINATION_PREFIX || Remote name and destination path to upload ||
12
12
| SE_UPLOAD_PIPE_FILE_NAME || Set the pipe file name for video upload to consume ||
@@ -162,9 +162,9 @@
162
162
| SE_BIND_BUS | true | When true, the Standalone will start the Event Bus and connect itself. Standalone also expose publishing and subscribing port for sidecar service can listen on session events. | --bind-bus |
163
163
| SE_EVENT_BUS_IMPLEMENTATION || Full class name of non-default event bus implementation. For example: org.openqa.selenium.events.zeromq.ZeroMqEventBus | --events-implementation |
164
164
| SE_NODE_KUBERNETES_CONFIG_FILENAME | kubernetes.toml | A separate TOML config file name for Dynamic Grid in Kubernetes, which avoid conflict with browser config if shared mouted volume ||
165
-
| SE_UPLOAD_FAILURE_SESSION_EVENTS |:failed,:failure| By default, a failure session event type contains ":failed" or ":failure" fires that will trigger the upload failure session only. User can define more event types which handled in your test framework, separated by comma. ||
166
-
| SE_UPLOAD_FAILURE_SESSION_ONLY | false | When true, only recording of sessions that are not exited normally (session timed out, or custom events were fired by the client match with failure events defined) ||
167
165
| SE_VIDEO_EVENT_DRIVEN | true | Backend of video recorder and uploader will subscribe to Grid Event Bus for session event lifecycle for processing instead of traditional polling Node session capabilities via /status endpoint. ||
| SE_DYNAMIC_MAX_SESSIONS || Set the number of maximum concurrent sessions of Dynamic Node (both Docker and Kubernetes) ||
170
168
| SE_DYNAMIC_OVERRIDE_MAX_SESSIONS || Enable this flag for setting max session take effect in Dynamic Node (both Docker and Kubernetes) ||
169
+
| SE_FAILURE_SESSION_EVENTS |:failed,:failure,:error,:aborted| By default, a failure session event type contains ":failed", ":failure", ":error" or ":aborted" substrings that trigger the retain-on-failure sub-sequence. User can define more event types which handled in your test framework, separated by comma. ||
170
+
| SE_RETAIN_ON_FAILURE | false | When true, recordings for sessions that pass are discarded immediately. Only sessions that fail (via failure events or abnormal close) retain their recordings and are queued for upload. ||
Copy file name to clipboardExpand all lines: README.md
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -813,7 +813,7 @@ services:
813
813
`SE_VIDEO_FILE_NAME=auto` will use the session id as the video file name. This ensures that the video file name is unique to upload.
814
814
Video file name construction automatically works based on Node endpoint `/status` (and optional GraphQL endpoint) to get session ID, capabilities.
815
815
816
-
`SE_VIDEO_UPLOAD_ENABLED=true` (`false` by default) will enable the video upload feature. In the background, it will create a pipefile with file and destination for uploader to consume and proceed.
816
+
`SE_VIDEO_UPLOAD_ENABLED=true` enables upload in the legacy shell-based mode (`SE_VIDEO_EVENT_DRIVEN=false`). In event-driven mode (the default), this variable is **deprecated** — upload is enabled automatically when `SE_UPLOAD_DESTINATION_PREFIX` is set to a non-empty value.
817
817
818
818
`SE_VIDEO_INTERNAL_UPLOAD=true` (by default) will use RCLONE installed in the container for upload. If you want to use another sidecar container for upload, set it to `false`.
819
819
@@ -846,6 +846,70 @@ When using in Dynamic Grid, those variables should be combined with the prefix `
846
846
| `SE_UPLOAD_CONFIG_FILE_NAME` | `upload.conf` | Config file for remote host instead of set via env variable prefix SE_RCLONE_* |
847
847
| `SE_UPLOAD_CONFIG_DIRECTORY` | `/opt/bin` | Directory of config file (change it when conf file in another directory is mounted) |
848
848
849
+
### Retain recordings for failed sessions only
850
+
851
+
In event-driven mode (`SE_VIDEO_EVENT_DRIVEN=true`, the default), the video service subscribes to the Grid's ZeroMQ event bus and reacts to session lifecycle events in real time. This enables a **retain-on-failure** strategy: record every session, but automatically discard the video when the session passes and only keep (and upload) recordings from sessions that fail.
852
+
853
+
Enable it globally with the environment variable:
854
+
855
+
```yaml
856
+
SE_RETAIN_ON_FAILURE=true
857
+
```
858
+
859
+
A session is treated as **failed** when either of the following is true:
860
+
861
+
1. The test code fires a session event whose `eventType` contains a substring from `SE_FAILURE_SESSION_EVENTS` (default: `:failed,:failure,:error,:aborted`).
862
+
2. The session closes with an abnormal reason — `TIMEOUT`, `NODE_REMOVED`, or `NODE_RESTARTED` — instead of the normal `QUIT_COMMAND`.
|`SE_RETAIN_ON_FAILURE`|`false`| Discard recordings of sessions that pass. Only recordings from failed sessions are retained on disk and queued for upload. |
867
+
|`SE_FAILURE_SESSION_EVENTS`|`:failed,:failure,:error,:aborted`| Comma-separated substrings. Any session event whose `eventType` contains one of these (case-insensitive) marks the session as failed. |
868
+
869
+
The `se:retainOnFailure` session **capability** overrides the global container env var for a specific session. For example, to retain the recording of a single session regardless of the global setting:
The [Session Event API](https://www.selenium.dev/blog/2026/selenium-grid-4-41-deep-dive/) lets test code push named events directly to the Grid. The video service listens for these events on the ZeroMQ bus and uses them to determine session failure.
885
+
886
+
Call `driver.fire_session_event(eventType, payload)` from your test. Any `eventType` that contains a configured failure substring (e.g. `"test:failed"` contains `":failed"`) marks the session as failed.
887
+
888
+
```python
889
+
from selenium.webdriver.chrome.options import Options as ChromeOptions
>**Note:** If the test catches an exception and still calls `driver.quit()` normally, the session close reason is `QUIT_COMMAND` (not abnormal). In that case, firing a failure event **before**`quit()` is the only way to mark the session as failed and prevent the recording from being discarded.
910
+
911
+
So, you can control the **retain-on-failure** strategy fully from test code via session capabilities and fire session event.
912
+
849
913
## Video recordings manager
850
914
851
915
We utilize [File Browser](https://filebrowser.org/) as a video manager. It is a web-based file manager that allows you to manage files and folders in the storage.
0 commit comments