UNPKG

webdriverio

Version:

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

45 lines 2.19 kB
import type { local } from 'webdriver'; import { SessionManager } from './session.js'; export declare function getContextManager(browser: WebdriverIO.Browser): ContextManager; export type FlatContextTree = Omit<local.BrowsingContextInfo, 'children'> & { children: string[]; }; /** * This class is responsible for managing context in a WebDriver session. Many BiDi commands * require to be executed in a specific context. This class is responsible for keeping track * of the current context and providing the current context the user is in. */ export declare class ContextManager extends SessionManager { #private; constructor(browser: WebdriverIO.Browser); removeListeners(): void; /** * set context at the start of the session */ initialize(): Promise<string>; setCurrentContext(context: string): void; getCurrentContext(): Promise<string>; get isNativeContext(): boolean; get mobileContext(): string | undefined; /** * Get the flat context tree for the current session * @returns a flat list of all contexts in the current session */ getFlatContextTree(): Promise<Record<string, FlatContextTree>>; /** * Find the parent context of a given context id * @param contextId the context id you want to find the parent of * @param contexts the list of contexts to search through returned from `browsingContextGetTree` * @returns the parent context of the context with the given id */ findParentContext(contextId: string, contexts: local.BrowsingContextInfoList): local.BrowsingContextInfo | undefined; /** * Find a context by URL or ID * @param urlOrId The URL or ID of the context to find * @param contexts The list of contexts to search through returned from `browsingContextGetTree` * @param matcherType The type of matcher to use to find the context * @returns The context with the given URL or ID */ findContext(urlOrId: string, contexts: local.BrowsingContextInfoList | null, matcherType: 'byUrl' | 'byUrlContaining' | 'byContextId'): local.BrowsingContextInfo | undefined; } //# sourceMappingURL=context.d.ts.map