Skip to main content

@svatah/yam-adapter-bidi

WebDriver BiDi adapter (independence proof)

Exports

ExportKindSignature
Actionabilityinterfaceexport interface Actionability
actionabilityOffunctionexport function actionabilityOf(options: { handles: string; registry: string; index: number; from: "handle" | "registry" }): Actionability | nullThe actionability facts for one element (LLD §7.3).
BIDI_ADAPTER_NAMEvariableBIDI_ADAPTER_NAME = "bidi"The name this adapter is selected by in yam.config.yaml (LLD §2.4).
BIDI_BROWSER_ENVvariableBIDI_BROWSER_ENV = "YAM_BIDI_BROWSER"YAM_BIDI_BROWSER: the Gecko binary to launch.
BIDI_CAPABILITIESvariableBIDI_CAPABILITIES: Capabilities What this adapter can do (LLD §2.4, §7.3).
BIDI_URL_ENVvariableBIDI_URL_ENV = "YAM_BIDI_URL"YAM_BIDI_URL: attach to a BiDi endpoint someone else is hosting.
BidiAdapterOptionsinterfaceexport interface BidiAdapterOptions extends LaunchOptions
bidiAvailablefunctionexport function bidiAvailable(Whether this machine can run the BiDi adapter at all.
BidiClientclassexport class BidiClient
BidiClientOptionsinterfaceexport interface BidiClientOptions
BidiEndpointinterfaceexport interface BidiEndpointWhere a session is talking, and to what.
BidiErrorclassexport class BidiError extends ErrorA protocol-level refusal, before it becomes one of the surface's errors.
BidiEventinterfaceexport interface BidiEventOne unsolicited message: { method, params } with no id.
BidiEventHandlertypealiasexport type BidiEventHandler = (event: BidiEvent) => void;
BidiSessionclassexport class BidiSession
BidiSurfaceclassexport class BidiSurface implements AgentSurface
ContextIdtypealiasexport type ContextId = string;A BiDi browsing context id: a top-level tab, or a frame inside one.
createBidiSurfacefunctionexport function createBidiSurface(Build a surface from a project config (LLD §2.4).
describeElementfunctionexport function describeElement(
evaluateBidiPredicatefunctionexport async function evaluateBidiPredicate(
findGeckofunctionexport function findGecko(The first Gecko binary that exists, or nothing.
fromRemoteValuefunctionexport function fromRemoteValue(remote: unknown): unknownTurn BiDi's tagged RemoteValue back into a plain JSON value.
HANDLESvariableHANDLES = "__yamHandles__"The in-page array locate() fills, for refs minted from a stored candidate.
keyActionsfunctionexport async function keyActions(press, keyDown and keyUp, including chords like "Control+a".
keyValuefunctionexport function keyValue(name: string): stringThe codepoint a key name means, or the name itself when it is one character.
LaunchOptionsinterfaceexport interface LaunchOptions
literalValuefunctionexport function literalValue(ref: ValueRef): stringThe literal a ValueRef names.
locateInPagefunctionexport function locateInPage(options:Candidate → indices into the handle registry (LLD §6.3, REQ-RUN-5).
openEndpointfunctionexport async function openEndpoint(options: LaunchOptions = {}): Promise<BidiEndpoint>Open a BiDi endpoint: attach to one, or launch a browser that serves one.
pointerClickfunctionexport async function pointerClick(One pointer action against an element.
pointerDragfunctionexport async function pointerDrag(Press, hold, move and release: dragTo (LLD §7.1's action table).
RawCandidateinterfaceexport interface RawCandidateThe subset of Candidate a web adapter can honour, flattened for the wire.
RawDescriptioninterfaceexport interface RawDescriptionThe shape describeElement returns. Mirrors ElementDescription minus ref.
RawNodeinterfaceexport interface RawNodeThe shape walkDocument returns for one node. Mirrors SnapshotNode.
RefSpaceclassexport class RefSpaceEverything snapshot, locate, describe and act need to turn a Ref
registerBidiAdapterfunctionexport function registerBidiAdapter(): voidRegister the adapter. Idempotent, because the registry refuses a silent
REGISTRYvariableREGISTRY = "__yamRefs__"The in-page array walkDocument fills. Reset by every walk and lost on
toLocalValuefunctionexport function toLocalValue(value: unknown): LocalValueTurn a plain JSON value into BiDi's tagged LocalValue form.
typeTextfunctionexport async function typeText(session: BidiSession, text: string): Promise<void>Type text into whatever has focus, one key at a time.
walkDocumentfunctionexport function walkDocument(options: