import { Locator, WebElement } from "selenium-webdriver"; import { AbstractElement } from "./AbstractElement"; /** * Heavily inspired by https://stackoverflow.com/a/65418734 */ type Constructor = new (...args: any[]) => T; /** * The interface that a class is required to have in order to use the Webview mixin. */ interface WebviewMixable extends AbstractElement { getViewToSwitchTo(handle: string): Promise; } /** * The interface that is exposed by applying this mixin. */ export interface WebviewMixinType { findWebElement(locator: Locator): Promise; findWebElements(locator: Locator): Promise; switchToFrame(timeout?: number): Promise; switchBack(): Promise; } /** * Returns a class that has the ability to access a webview. * * @param Base the class to mixin * @returns a class that has the ability to access a webview */ export default function >(Base: TBase): Constructor & WebviewMixinType>; export {};