selenium.webdriver.common._bidi.serialization#
Serialization runtime for the generated WebDriver BiDi protocol layer.
Hand-written support for the generated selenium.webdriver.common._bidi.* modules
(not itself generated). Provides the immutable value-type base (Record),
the discriminated-union dispatch base (Union), and the UNSET
sentinel that distinguishes an omitted optional from an explicit wire null.
Each generated field carries its wire facts as dataclass field metadata (see
meta()), so a record’s Python fields are its single source of truth — there
is no parallel field table.
This is internal, unsupported implementation. See https://www.selenium.dev/documentation/warnings/bidi-implementation/
Module Attributes
Marks an omitted optional. |
Functions
|
Dataclass field metadata carrying one field's BiDi wire facts. |
|
Class decorator registering a generated class under its schema type name. |
|
Classes
|
Immutable value-type base for generated params/results/event payloads. |
|
Dispatch base for a discriminated union; subclassed, never instantiated. |
Type of the |
Exceptions
|
A payload could not be (de)serialized against this Selenium's BiDi schema. |
- exception BiDiSerializationError(msg=None, screen=None, stacktrace=None)[source]#
Bases:
WebDriverExceptionA payload could not be (de)serialized against this Selenium’s BiDi schema.
- Parameters:
msg (Any | None)
screen (str | None)
stacktrace (Sequence[str] | None)
- Return type:
None
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class UnsetType[source]#
Bases:
objectType of the
UNSETsentinel (an omitted optional, notNone).- Return type:
- UNSET: UnsetType = UNSET#
Marks an omitted optional. Dropped from the wire; distinct from
None(explicit null).
- meta(name, *, required=False, nullable=False, ref=None, is_list=False, enum=None, primitive=None, scalar=None, fixed=UNSET)[source]#
Dataclass field metadata carrying one field’s BiDi wire facts.
Used as
x: T = field(metadata=meta(...))in the generated modules — a plaindataclasses.fieldso it reads as an ordinary dataclass field. A baked discriminator additionally setsdefault=<const>, init=Falseon the field.scalarmarks a map field (a[key, value]list whose value type is an object-only union): the union’s string keys pass through when they match this primitive, rather than being rejected as non-objects.- Parameters:
name (str)
required (bool)
nullable (bool)
ref (str | None)
is_list (bool)
enum (str | None)
primitive (str | None)
scalar (str | list[str] | None)
fixed (Any)
- Return type:
dict
- register(schema_name)[source]#
Class decorator registering a generated class under its schema type name.
- Parameters:
schema_name (str)
- Return type:
Callable[[type], type]
- class Record[source]#
Bases:
objectImmutable value-type base for generated params/results/event payloads.
Subclasses are
@dataclass(frozen=True)whose fields are declared withmeta(). The object itself is permissive; validation lives at the boundaries. Outbound (as_json()) omitsUNSET, emitsnullonly for nullable fields, and errors if a required field is unset. Inbound (from_json()) errors on a corrupt value or a missing required field, and tolerates only an undeclared property, so a browser that adds a field does not break a client generated from an older schema.
- class Union[source]#
Bases:
objectDispatch base for a discriminated union; subclassed, never instantiated.
Carries the schema’s authoritative
selectoras class attributes: a discriminator wire key + tag->variant table, and/or presence-ordered rules, and an optional declared fallback. Inbound (from_json()) resolves a payload to a variant; outbound (build()) selects the variant a command’s kwargs describe.- classmethod validate_outbound(owner, name, value)[source]#
Reject an outbound value that is not one of this union’s variants.
A variant instance passes. A bare scalar passes only for a union that has a scalar arm, and only as one of the literals that arm declares, so a stray string is a caller error rather than a wire round-trip. This mirrors inbound dispatch, which errors on the same values.
- Parameters:
owner (str)
name (str)
value (Any)
- Return type:
None