UNPKG

webdriverio

Version:

Next-gen browser and mobile automation test framework for Node.js

45 lines • 2.33 kB
/** * Classic WebDriver element endpoints only see the session's current * browsing context, and WebDriver BiDi has no way to run them in another * one. An element found in another held context (a frame, or a tab that is * not the current one) is handled in its own document instead, the way a * BiDi client such as Puppeteer does it: BiDi commands where one exists * (`browsingContext.locateNodes`, `input.performActions`, `input.setFiles`, * `browsingContext.captureScreenshot`), and otherwise the steps of the * WebDriver spec in a script. * * `routeElementEndpoints` wraps those endpoints on every element object, so * each element command that is built on them works in any held context * without a branch of its own. Elements of the current context still go to * classic WebDriver unchanged. * * @see https://w3c.github.io/webdriver/#elements */ /** * The held context `scope` belongs to, when that is not the session's * current context. */ export declare function foreignContext(scope: unknown): Promise<WebdriverIO.BrowsingContext | undefined>; /** * The link text strategies of the spec in a held context: every `<a>` below * `elementId` (or in the document) whose rendered text, trimmed, equals or * contains `value`. The rendered text comes from the getVisibleText atom, so * a background tab that is not rendered still skips hidden text. * * @see https://w3c.github.io/webdriver/#link-text */ export declare function findLinksInContext(held: WebdriverIO.BrowsingContext, using: 'link text' | 'partial link text', value: string, elementId?: string, maxNodeCount?: number): Promise<Record<string, string>[]>; type Endpoint = (held: WebdriverIO.BrowsingContext, elementId: string, ...args: never[]) => Promise<unknown>; /** * The classic element endpoints element commands are built on, implemented * in the element's own browsing context. */ export declare const FOREIGN_ELEMENT_ENDPOINTS: Record<string, Endpoint>; /** * Route the classic element endpoints on an element's property descriptors: * an element of another held context goes to `FOREIGN_ELEMENT_ENDPOINTS`, * every other element to classic WebDriver as before. */ export declare function routeElementEndpoints(properties: PropertyDescriptorMap): PropertyDescriptorMap; export {}; //# sourceMappingURL=foreignContext.d.ts.map