skip to content

In Selenium Grid, what does the se: capability namespace hold, and what do se:name and se:recordVideo do?

level: middleimportance: should knowfreq 38%

answer

  1. a prefix the browser never reads
  2. colon-bearing keys pass validation
  3. metadata addressed to the grid itself
  4. one labels, one asks for a recording
  5. Selenium's own two-letter capability prefix

basics

~20 s

se: is Selenium's own capability prefix, read by the Grid and its nodes rather than by the browser. se:name labels the session in the Grid console and in any recording's file name; se:recordVideo asks a node that can record to capture that session.

solid answer

~40 s

In Selenium 4 a capability key containing a colon is an extension capability, so it survives the protocol's new-session validation instead of being rejected as unknown. `se:` is Selenium's own prefix, and keys under it are addressed to the Grid and its nodes, never to the browser. A client sets them on the options object it already builds: `options.setCapability("se:name", "canvas drag smoke")` gives the session a readable label in the Grid console and, on nodes that record, names the video after it, while `options.setCapability("se:recordVideo", true)` asks a recorder-equipped node to capture the run. Other members include `se:downloadsEnabled`, and `se:vncEnabled`, which the Grid reports back on the created session to say a live view exists. None of them take part in slot matching, and a node that does not know a key simply ignores it.

code

java · 16 lines
java
import java.net.URI;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;

public final class RecordedCanvasSession {

    public static RemoteWebDriver start(String gridEndpoint, String caseName) throws Exception {
        ChromeOptions options = new ChromeOptions();
        options.setCapability("se:name", caseName);
        options.setCapability("se:recordVideo", true);
        RemoteWebDriver driver = new RemoteWebDriver(URI.create(gridEndpoint).toURL(), options);
        Object liveView = driver.getCapabilities().getCapability("se:vncEnabled");
        System.out.println(caseName + " live view: " + liveView);
        return driver;
    }
}

go deeper

for a junior

Know that se: keys exist and are set like any other capability on the options object, and that se:name is the one that makes a session findable later by a human.

for a middle

Explain why a colon-bearing key is legal at all, who reads it, and why an unsupported one fails silently rather than erroring. That silence is the mechanic interviewers probe.

for a senior

Show how you use them operationally: labelling every session from its test name, and treating a recording flag as a request that only pays off where the fleet can honour it.

for a principal

Own the convention across suites, so sessions on a shared Grid are attributable by default and the cost of recording is a deliberate choice rather than a per-team habit.

## Why a prefixed key exists at all The W3C WebDriver protocol validates a new-session request: a top-level capability key it does not recognise is an error, **unless** the key contains a colon, which marks it as an **extension capability**. That escape hatch is what lets a browser vendor ship its own block of settings, and it is what lets Selenium ship its own. `se:` is Selenium's prefix, and in Selenium 4 the keys under it are instructions to **the Grid and its nodes** — not to the browser, which never sees them. A client sets them on the object it already builds, because a typed options class is a capability map underneath: ```java ChromeOptions options = new ChromeOptions(); options.setCapability("se:name", "canvas drag adds a rating block"); options.setCapability("se:recordVideo", true); ``` ## The keys a client sets - **`se:name`** holds a string: a human-readable label for the session. It is what turns a wall of identical session ids in the Grid console into something a person can scan, and on SeleniumHQ's `docker-selenium` node images the recorder uses it to name the video file it writes. Setting it to the test's own name is the usual choice for a survey-builder canvas suite, so a failed run maps to an artefact without anybody correlating timestamps by hand. - **`se:recordVideo`** holds a boolean. On a Grid whose nodes have a recorder attached, `true` asks for that session to be captured. It is a request, not a guarantee: the capability only does something where the recording machinery already exists. - **`se:downloadsEnabled`** holds a boolean and opts the session into the Grid's managed downloads area, so files the browser saved on the node can be listed and fetched afterwards rather than being stranded there. ## The keys the Grid hands back Not every `se:` key travels in your direction. Some appear in the **granted** capabilities the Grid returns when the session is created, and the client reads them with `getCapabilities()`: - **`se:vncEnabled`** is reported as `true` by a node that offers a live VNC view of the session, which tells a client that watching the run is possible at all. | key | who sets it | what it holds | what reads it | |---|---|---|---| | `se:name` | the client, in its options | a label string | the Grid console and the node's recorder | | `se:recordVideo` | the client, in its options | a boolean | a node with a recorder attached | | `se:downloadsEnabled` | the client, in its options | a boolean | the node's download handling | | `se:vncEnabled` | the Grid, on the created session | a boolean | your code, via `getCapabilities()` | ## What `se:` keys deliberately do not do 1. They do not configure the browser. Nothing under `se:` reaches Chrome or Firefox as a launch setting; the browser-specific blocks are a separate namespace entirely. 2. They do not change routing. The Grid picks a slot on the standard capabilities, so a session with a label lands exactly where the same session without one would have landed. 3. They do not fail loudly when unsupported. Because the protocol treats a colon-bearing key as a legitimate extension, a node that knows nothing about the key simply carries it and does nothing. Asking for a recording on a Grid with no recorder produces a perfectly healthy session and no video. That last point is the one that costs people an afternoon: the absence of an error is not evidence the key worked. ## Checking what your Grid honours Because unknown extension keys are silent, prove the effect rather than the spelling: - start one session with the key set, and read the granted capabilities back with `getCapabilities()`; - look for the session under the label you set, in the Grid's own view of running sessions; - for a recording, check that an artefact exists after the session ends, named as you expect; - keep the spelling exact — capability keys are case-sensitive, and `se:recordvideo` is simply a different, unrecognised extension key that will never be an error. ## Why this matters on a shared Grid A Grid serving several suites at once is anonymous by default: sessions are ids and browser names. `se:name` is the cheapest labelling any team can adopt, and it is what makes the difference between a canvas run whose failing session can be found later and one that cannot. `se:recordVideo` turns a hard-to-reproduce failure — a drag that dropped a rating block in the wrong place once in fifty runs — into something reviewable. Both are client-side, both are one line, and neither changes where the session runs.

  • Does setting se:recordVideo change which node the Grid picks for the session?
    No. Extension-namespaced keys are carried to the session, not used to match a slot, so a labelled or recording-flagged request lands exactly where the same request without those keys would. If only some nodes can record, that is a fleet layout question, not something the capability negotiates for you.
  • How do you find out which se: keys the Grid you are pointed at actually honours?
    Prove the effect, not the spelling. Start one session with the key set, read the granted capabilities back with getCapabilities(), look for the session under the label you gave it, and check that any artefact you expected exists. An unrecognised extension key is silently carried, so the absence of an error proves nothing.

saying these in an interview costs you the question

  • Thinks se: keys configure the browser rather than the Grid
  • Expects se:recordVideo to produce a video on a Grid with no recorder
  • Believes an se: key changes which node serves the request
  • Assumes an unrecognised se: key makes the session request fail
  • Reads se:vncEnabled as something the client requests rather than the Grid reports