import { Browser, BrowserContext, Locator, Page } from 'playwright-core'; import type Playwright from 'playwright'; export interface IDriverCfg { headless?: boolean; browserType?: 'chromium' | 'firefox' | 'webkit'; bizDirs?: string[]; appDir?: string; } export declare class WebDriver { cfg: IDriverCfg; locator: Locator; page: Page; browser: Browser; context: BrowserContext; constructor(cfg?: IDriverCfg); init(): Promise; stop(): Promise; mixin any>(api: T): this & ReturnType; goto(url: string): Promise; elementScreenShot(opts: { locator?: Locator; output: string; }): Promise; redirect(url: string): Promise; getElement(value: string, opts: { use?: 'xpath' | 'name' | 'id'; contains?: boolean; }): Promise; getSelector(selector: string, opts?: { use?: 'xpath' | 'name' | 'id'; contains?: boolean; }): { use: string; selector: any; }; private findElementOrElements; curl(clean?: boolean): Promise; waitForElement(selector: string, timeout?: number): Promise; checkMulti(selectors: string[], options?: { use?: 'css' | 'xpath'; desc?: string; }): Promise; checkNotExists(selector: string, options?: { use?: 'css' | 'xpath'; desc?: string; timeout?: number; }): Promise; getText(selector: string, timeout?: number): Promise; checkText(text: string | RegExp, strict?: boolean, timeout?: number): Promise; checkMultiText(text: string[], strict?: boolean, timeout?: number): Promise; clickOn(selector: string, options?: { use?: 'css' | 'xpath'; desc?: string; clickOpts?: Parameters[0]; }): Promise; check(selector: string, options?: { use?: 'css' | 'xpath'; desc?: string; }): Promise; pressKeys(timesOrKey: EKeys | number, ...keys: EKeys[]): Promise; waitForFocusByCSS(css: string, timeout?: number): Promise; waitForAny(selectors: string[], opts?: { timeout?: number; }): Promise; getElementsCount(selector: string): Promise; input(text: string, selector?: string, option?: { use?: 'css' | 'xpath'; desc?: string; }): Promise; hover(selector: string, option?: { use?: 'css' | 'xpath'; desc?: string; }): Promise; mouse(action: T, ...args: Parameters): Promise; keyboard(action: T, ...args: Parameters): Promise; dragAndDrop(source: string, targetPos: { x: number; y: number; }, target?: string, option?: { use?: 'css' | 'xpath'; desc?: string; }): Promise; execute(script: string, args?: any[]): Promise; coverage(opts: { coverageIgnore?: string; keys?: string[]; coverageHandler?: any; }): Promise; /** * 前端注入js执行webapi的调用 */ webFetch(opts: { api: string; method?: 'POST' | 'GET' | 'DELETE' | 'PUT' | 'PATCH'; params?: any; headerOpts?: any; fetchOpts?: any; }): Promise; } export declare enum EKeys { ArrowLeft = "ArrowLeft", ArrowRight = "ArrowRight", ArrowUp = "ArrowUp", ArrowDown = "ArrowDown", Enter = "Enter", Shift = "Shift", ShiftLeft = "ShiftLeft", Control = "Control", Space = "Space", Backspace = "Backspace", Tab = "Tab", Delete = "Delete", Backslash = "Backslash", Slash = "Slash", Escape = "Escape", Alt = "Alt", Meta = "Meta", Mode = "Mode",// windows is Control macOS is Meta Digit0 = "DigitO", Digit1 = "Digit1", Digit2 = "Digit2", Digit3 = "Digit3", Digit4 = "Digit4", Digit5 = "Digit5", Digit6 = "Digit6", Digit7 = "Digit7", Digit8 = "Digit8", Digit9 = "Digit9", KeyA = "KeyA", KeyB = "KeyB", KeyC = "KeyC", KeyD = "KeyD", KeyE = "KeyE", KeyF = "KeyF", KeyH = "KeyH", KeyI = "KeyI", KeyJ = "KeyJ", KeyK = "KeyK", KeyL = "KeyL", KeyM = "KeyM", KeyN = "KeyN", KeyO = "KeyO", KeyP = "KeyP", KeyQ = "KeyQ", KeyR = "KeyR", KeyS = "KeyS", KeyT = "KeyT", KeyU = "KeyU", KeyV = "KeyV", KeyW = "KeyW", KeyX = "KeyX", KeyY = "KeyY", KeyZ = "KeyZ" }