skip to content

Why do a hosted browser provider's settings arrive as one colon-prefixed capability map?

level: juniorimportance: must knowfreq 68%

answer

  1. the standard table is closed
  2. one door: the extension capability
  3. the colon is mandatory, not stylistic
  4. the spec names the intermediary node
  5. one key, so one deletion removes it

basics

~20 s

W3C WebDriver reserves the colon for extension capabilities, so a provider's settings must sit under prefixed keys; gathering them into a single map is convention, not a rule. Loose non-standard keys are not capabilities the specification recognises at all.

solid answer

~50 s

The W3C WebDriver specification publishes a closed table of standard capabilities and gives everyone else exactly one way in: an **extension capability**, whose key *must contain a `:`* denoting an implementation-specific namespace. The spec says such capabilities are typically used for user-agent **or intermediary-node** configuration — and a hosted grid is an intermediary node, sitting between your client and the browser. So a provider's own settings have no legal home except a namespaced key, and the practical shape is one prefixed key holding an object of everything the provider understands. The open products show the same shape for the same reason: Selenoid — unmaintained, per its own README — reads its settings from `selenoid:options`, and Selenium Grid uses its `se:` namespace. Grouping them under one key also means a single deletion removes the whole set before the request goes on to the browser.

code

json · 11 lines
json
{
  "capabilities": {
    "alwaysMatch": {
      "browserName": "firefox",
      "selenoid:options": {
        "enableVNC": true,
        "screenResolution": "1280x1024x24"
      }
    }
  }
}

go deeper

for a junior

Be able to say that non-standard settings must live under a key containing a colon, and to recognise the one-prefixed-object shape when you read a session request. That recognition alone answers the screening version of this question.

for a middle

Be ready to name the mechanism as the spec's extension capability and to explain that a hosted grid qualifies as an intermediary node, which is one of the two uses the specification itself names for it.

for a senior

Be ready to explain why grouping under a single key matters operationally: an intermediary must remove its own namespace before forwarding, and one key is one deletion that cannot miss a stray sibling.

for a principal

Be ready to decide how much provider-specific vocabulary belongs in a suite at all, given that the namespaced shape is standard but everything inside it is a private contract you cannot check against any artefact.

## The specification leaves exactly one door open A WebDriver `New Session` request is not a free-form settings bag. The W3C WebDriver specification defines a **table of standard capabilities** — the browser's name and version, the platform, the page load strategy, the proxy configuration and a few more — and that table is closed. Which keys sit in it, and how a client negotiates them, is capability negotiation's subject; what matters here is that you cannot add a row. For everything outside the table the spec defines the **extension capability**: an extra capability *"used to provide configuration or fulfill other vendor-specific needs"*, whose key **must contain a `:` (colon) character**, denoting an implementation-specific namespace. The value may be arbitrary JSON. That is the entire mechanism, and every non-standard setting you have ever sent to a browser or a grid went through it. ## Why an intermediary is the spec's own example The spec's illustration of what extension capabilities are for names two consumers: they are *"typically used to provide UA or intermediary node specific configuration that is not handled by the table of standard capabilities."* An **intermediary node** is the spec's term for something that sits in the request path, accepts a `New Session` and routes it onward to an **endpoint node** that owns the actual browser. A hosted browser provider is exactly that. So the namespaced map is not a vendor's stylistic choice — it is the only shape the standard offers something in that position. That produces a recognisable pattern across products that never coordinated: - Selenoid — unmaintained, per its own README — reads its per-session settings from `selenoid:options`. - Selenium Grid uses its own `se:` namespace for grid-level concerns. - Browser vendors do the same thing one hop further down for engine options. - A hosted provider does it for account, run-labelling and capture settings. Four different owners, one shared rule, because the specification gave them one shared door. ## Why one key rather than many The colon rule alone would permit a provider to send several top-level namespaced keys. In practice the settings arrive as a single prefixed key whose value is an object. Three reasons stack up: 1. **Stripping is one operation.** An intermediary must not forward its own extension capabilities to the endpoint node, and removing one key is trivially correct where removing a scattered set risks missing one. 2. **The namespace stays stable while the vocabulary moves.** New settings appear inside the object without any new top-level key, so nothing on the wire changes shape. 3. **The grouping documents ownership.** Reading a request, a single prefixed object says plainly which hop each setting is aimed at — the browser's own options map is visibly separate. ## What the map is not Being inside a namespace does not make a setting privileged or validated: - Nothing checks the *contents* of a namespace you do not own. A misspelling inside the object is accepted and ignored. - Nothing in the specification checks the prefix, so an invented namespace is as legal on the wire as a real one — though a client library's own key filter may be fussier about its shape. - The map is still ordinary capabilities data, so it travels in `alwaysMatch` or in a `firstMatch` entry like anything else. ## The same setting, both spellings The documentation of Selenoid (unmaintained, per its own README) shows the two forms side by side and states the reason for the second in as many words: some clients will carry only capabilities the specification names, so the namespaced spelling exists so that a strict client can still deliver a non-standard setting. The pair is worth memorising because it is the whole idea in two lines — the same value, once as a loose key that only a lenient client will carry, once wrapped in a namespace that everything will carry. Concretely, for a school-timetabling web app whose weekly grid needs a wide viewport to render without clipping, the request either carries a bare resolution key that a strict client refuses to send, or the same value inside the owning namespace, which every hop carries whether or not it understands it. ## What to take into an interview The answer that lands is short and mechanical: - The standard capability table is **closed**. - Anything else must be an **extension capability**, and its key **must contain a colon**. - A hosted provider is an **intermediary node**, which is one of the two cases the spec names for extension capabilities. - Therefore the provider's settings arrive namespaced, and grouping them under one key makes them removable in one step before the request continues to the browser. Notice what that answer never needs: the name of any particular provider's prefix, or any key inside it. The shape is a consequence of the standard, and you can explain it completely without knowing a single vendor's vocabulary — which is also why the shape has stayed stable while individual vendors' settings have not.

  • Could a provider legally send its settings as loose top-level capability keys instead?
    Not as capabilities. A non-standard key without a colon is not an extension capability, and the spec's validation algorithm has an endpoint node return `invalid argument` for it; strict clients refuse to send it at all. The spec does offer a separate route for information unrelated to user-agent features — top-level parameters sitting beside `capabilities` — but that is a different part of the request body, not a loose capability.
  • What does the spec say the prefix before the colon should be?
    It suggests the namespace be based on the CSS vendor keywords, and treats everything before the first colon as that namespace. It is a suggestion, not a constraint: nothing in the specification validates the prefix, and no registry exists — though a client library's own key filter may still refuse an unusual one. In practice the prefix is a short owner name chosen by whoever defined the capability, which is why reading one tells you which hop the setting is addressed to.
  • Does putting settings in a namespace guarantee the far side understands them?
    No. The namespace is addressing, not agreement. A hop that does not own the prefix keeps the value unchanged and passes it on without inspecting it, and the hop that does own it will silently ignore an inner key it does not define. A namespaced setting that never took effect looks exactly like one that did, so assert the effect rather than the request.

saying these in an interview costs you the question

  • Calls the mandatory colon a vendor convention rather than a specification rule
  • Thinks any string can be sent as a top-level capability
  • Says the colon is only there for readability
  • Assumes a namespace implies the far side validates the contents
  • Confuses the provider's namespace with the browser engine's options map