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
## Video recording with dynamic file name based on metadata in tests
559
+
560
+
Based on the support of [Metadata in tests](https://www.selenium.dev/documentation/grid/getting_started/#metadata-in-tests). When the video recorder is sidecar deployed with the browser node with enabling `SE_VIDEO_FILE_NAME=auto` and adding metadata to your tests, video file name will extract value of capability `se:name` and use it as the video file name.
561
+
562
+
For example in Python binding:
563
+
564
+
```python
565
+
from selenium.webdriver.chrome.options import Options as ChromeOptions
The output video file name will be `test_visit_basic_auth_secured_page_ChromeTests_<sessionId>.mp4`.
576
+
577
+
If your test name is handled by the test framework, and it is unique for sure, you also can disable the session id appends to the video file name by setting `SE_VIDEO_FILE_NAME_SUFFIX=false`.
578
+
579
+
File name will be trimmed to 255 characters to avoid long file names. Moreover, `space` character will be replaced by `_` and only characters alphabets, numbers, `-` (hyphen), `_` (underscore) are retained in the file name.
580
+
581
+
The trim regex is able to be customized by setting `SE_VIDEO_FILE_NAME_TRIM_REGEX` environment variable. The default value is `[:alnum:]-_`. The regex should be compatible with the `tr` command in bash.
582
+
583
+
At deployment level, the recorder container is up always. In addition, you can disable video recording process via session capability `se:recordVideo`. For example in Python binding:
584
+
585
+
```python
586
+
options.set_capability('se:recordVideo', False)
587
+
```
588
+
589
+
In recorder container will perform query GraphQL in Hub based on Node SessionId and extract the value of `se:recordVideo` in capabilities before deciding to start video recording process or not.
590
+
591
+
Notes: To reach the GraphQL endpoint, the recorder container needs to know the Hub URL. The Hub URL can be passed via environment variable `SE_NODE_GRID_URL`. For example `SE_NODE_GRID_URL` is `http://selenium-hub:4444`.
592
+
557
593
## Video recording and uploading
558
594
559
595
[RCLONE](https://rclone.org/) is installed in the video recorder image. You can use it to upload the videos to a cloud storage service.
@@ -836,6 +872,25 @@ for example:
836
872
837
873
After running a test, check the path you mounted to the Docker container,
838
874
(`${PWD}/assets`), and you should see videos and session information.
875
+
876
+
From language bindings, you can set the `se:name` capability to change output video file name dynamically. For example, in Python binding:
877
+
878
+
```python
879
+
from selenium.webdriver.chrome.options import Options as ChromeOptions
After test executed, under (`${PWD}/assets`) you can see the video file name in path `/<sessionId>/test_visit_basic_auth_secured_page_ChromeTests.mp4`
892
+
893
+
The file name will be trimmed to 255 characters to avoid long file names. Moreover, the `space` character will be replaced by `_`, and only the characters alphabets, numbers, `-` (hyphen), and `_` (underscore) are retained in the file name. (This feat is available once this [PR](https://github.com/SeleniumHQ/selenium/pull/13907) merged)
0 commit comments