@svatah/yam-adapter-playwright
Default web adapter: AgentSurface on Playwright
- Source:
packages/adapter-playwright· README:packages/adapter-playwright/README.md - Install:
npm install @svatah/yam-adapter-playwright - Version 0.1.0 · Apache-2.0
Exports
| Export | Kind | Signature | |
|---|---|---|---|
ariaSnapshotText | function | export async function ariaSnapshotText(frame: Frame): Promise<string> | The public ariaSnapshot() text for the frame. |
BrowserName | typealias | export type BrowserName = "chromium" | "firefox" | "webkit"; | |
callTool | function | export async function callTool( | Call a declared tool. |
CheckContext | interface | export interface CheckContext | |
chooseMechanism | function | export async function chooseMechanism( | Resolve YAM_PW_SNAPSHOT into a mechanism, probing the frame for auto. |
coordsOf | function | export function coordsOf(candidate: Candidate): { x: number; y: number } | "x,y" from a coords candidate. |
createPlaywrightSurface | function | export function createPlaywrightSurface( | Build a surface from a project config (LLD §2.4). |
DeclaredTool | interface | export interface DeclaredTool | One tool a page declares. |
declaredTools | function | export async function declaredTools(frame: Frame): Promise<DeclaredTool[]> | Every tool the page currently declares, in declaration order. |
declaresTool | function | export async function declaresTool(frame: Frame, name: string): Promise<boolean> | Whether the page declares a tool by this name, right now. |
DEFAULT_MAX_NODES | variable | DEFAULT_MAX_NODES = 2000 | Default cap on nodes; a larger page is truncated in document order. |
describeElement | function | export function describeElement( | |
evaluatePredicate | function | export async function evaluatePredicate( | |
lengthBucket | function | declare function lengthBucket(value: string | undefined): string; | Names collapse to a length bucket: 0, 1-8, 9-32, 33+ (LLD §6.2). |
literalValue | function | export function literalValue(ref: ValueRef): string | |
locatorFor | function | export function locatorFor( | Build the locator a candidate names, or null when the candidate is one the |
OBSERVED_ATTRIBUTE | variable | OBSERVED_ATTRIBUTE = "data-yam-observed" | The in-page observer (Draft 2.23, REQ-REC-13): what a person does in the |
OBSERVER_BINDING | variable | OBSERVER_BINDING = "__yamObserved" | |
OBSERVER_SCRIPT | variable | OBSERVER_SCRIPT = (() =>` | |
parseAiSnapshot | function | export function parseAiSnapshot(text: string): SnapshotNode[] | |
PICKED_ATTRIBUTE | variable | PICKED_ATTRIBUTE = "data-yam-picked" | The attribute the picker stamps on the clicked element. |
PICKER_SCRIPT | variable | PICKER_SCRIPT = (id) =>` | The in-page picker: highlight what the pointer is over, resolve on click. |
PLAYWRIGHT_ADAPTER_NAME | variable | PLAYWRIGHT_ADAPTER_NAME = "playwright" | The name this adapter is selected by in yam.config.yaml (LLD §2.4). |
PLAYWRIGHT_CAPABILITIES | variable | PLAYWRIGHT_CAPABILITIES: Capabilities | The capability descriptor for this adapter (LLD §2.4). |
PlaywrightAdapterOptions | interface | export interface PlaywrightAdapterOptions | Everything the adapter needs that is not in SessionInit. |
playwrightMechanismAvailable | function | export async function playwrightMechanismAvailable(frame: Frame): Promise<boolean> | Whether the Playwright mechanism answers on this frame. |
PlaywrightSurface | class | export class PlaywrightSurface implements AgentSurface | |
RawDescription | interface | export interface RawDescription | The shape describeElement returns. Mirrors ElementDescription minus ref. |
RawNode | interface | export interface RawNode | The shape walkDocument returns for one node. Mirrors SnapshotNode. |
RefSpace | class | export class RefSpace | Everything snapshot, locate, describe and act need in order to turn a |
registerPlaywrightAdapter | function | export function registerPlaywrightAdapter(): void | Register the adapter. Idempotent, because the registry refuses a silent |
REGISTRY | variable | REGISTRY = "__yamRefs__" | The in-page array walkDocument fills; see page-script.ts. |
renderForHash | function | declare function renderForHash(nodes: readonly SnapshotNode[]): string; | The canonical rendering the hash is taken over: one line per node, indented by |
ScriptedAction | interface | export interface ScriptedAction | One action a scripted person performs (YAM_OBSERVE, the test affordance). |
SnapshotMechanism | typealias | export type SnapshotMechanism = "playwright" | "own"; | |
SnapshotOptions | interface | export interface SnapshotOptions | |
structuralHash | function | declare function structuralHash(nodes: readonly SnapshotNode[]): string; | sha256 of renderForHash, hex encoded. |
takeSnapshot | function | export async function takeSnapshot( | Take a snapshot through the session's mechanism (LLD §2.2). |
ToolCall | interface | export interface ToolCall | |
translate | function | export function translate(error: unknown): unknown | Playwright's errors carry their cause in the message. Mapping them onto the |
walkDocument | function | export function walkDocument(options: |