import type { IWebDriverElement } from "./IWebDriverElement"; import type { IWebDriverWindow } from "./IWebDriverWindow"; import type { LocatorTypes } from "./locatorTypes"; import type { WebDriverAction } from "./webDriverAction"; import type { WindowLocatorTypes } from "./windowLocatorTypes"; import type { WindowLocatorIdentityStringValueTypes, WindowLocatorIdentityValueTypes, WindowLocatorValueTypes } from "./windowLocatorValueTypes"; /** * Web driver interface. */ export interface IWebDriver { /** * Start a new session on the driver. * @param devToolsPort The devtool port. * @param chromeDriverPort The chromedriver port. * @param logLevel The level of logging. * @param screenshotFolder The folder for storing screen shots. * @param openFinRVMPath The path to the OpenFin RVM. * @param openFinEnv Additional OpenFin environment data. * @param openFinEnv.workspaceVersion The version of workspace. * @param openFinEnv.notificationsVersion The version of notifications. * @returns Nothing. * @see https://w3c.github.io/webdriver/#dfn-new-sessions */ startSession(devToolsPort: number, chromeDriverPort: number, logLevel: "debug" | "silent", screenshotFolder: string, openFinRVMPath: string, openFinEnv: { workspaceVersion: string; notificationsVersion: string; }): Promise; /** * End a session on the driver. * @returns Nothing. * @see https://w3c.github.io/webdriver/#dfn-delete-session */ endSession(): Promise; /** * Execute JavaScript in the window. * @param script The script to execute. * @param args Arguments to pass to the async script. * @returns The response from the execute. * @see https://w3c.github.io/webdriver/#dfn-execute-async-script */ executeAsyncScript(script: string, args?: (string | object | number | boolean | undefined)[]): Promise; /** * Get the title of the current window. * @returns The window title. * @see https://w3c.github.io/webdriver/#dfn-get-title */ getTitle(): Promise; /** * Get the URL of the current window. * @returns The window title. * @see https://w3c.github.io/webdriver/#dfn-get-current-url */ getUrl(): Promise; /** * Set the URL of the current window. * @param url The url to navigate to. * @returns Nothing. * @see https://w3c.github.io/webdriver/#dfn-navigate-to */ setUrl(url: string): Promise; /** * Get the details of all the connected windows. * @returns The list of windows. * @see https://w3c.github.io/webdriver/#dfn-get-window-handles */ getWindows(): Promise; /** * Get the details of the current window. * @returns The current window if available. * @see https://w3c.github.io/webdriver/#dfn-get-window-handle */ getWindow(): Promise; /** * Switch to a window by locator. * @param locator The locator type. * @param locatorValue The window locator value to use. * @param activateNativeWindow Activate the native window as well, defaults to true. * @returns True if the window was available. * @see https://w3c.github.io/webdriver/#dfn-switch-to-window */ switchToWindow(locator: "title" | "url" | "handle" | "identityString", locatorValue: string | RegExp | (string | RegExp)[], activateNativeWindow?: boolean): Promise; /** * Switch to a window by locator. * @param locator The locator type. * @param locatorValue The window locator value to use. * @param activateNativeWindow Activate the native window as well, defaults to true. * @returns True if the window was available. * @see https://w3c.github.io/webdriver/#dfn-switch-to-window */ switchToWindow(locator: "identity", locatorValue: WindowLocatorIdentityValueTypes, activateNativeWindow?: boolean): Promise; /** * Switch to a window by locator. * @param locator The locator type. * @param locatorValue The window locator value to use. * @param activateNativeWindow Activate the native window as well, defaults to true. * @returns True if the window was available. * @see https://w3c.github.io/webdriver/#dfn-switch-to-window */ switchToWindow(locator: "identityString", locatorValue: WindowLocatorIdentityStringValueTypes, activateNativeWindow?: boolean): Promise; /** * Switch to a window by locator. * @param locator The locator type. * @param locatorValue The window locator value to use. * @param activateNativeWindow Activate the native window as well, defaults to true. * @returns True if the window was available. * @see https://w3c.github.io/webdriver/#dfn-switch-to-window */ switchToWindow(locator: WindowLocatorTypes, locatorValue: WindowLocatorValueTypes, activateNativeWindow?: boolean): Promise; /** * Find an element. * @param locator The locator to use when finding the element. * @param value The value to use with the locator. * @returns The element if found. * @see https://w3c.github.io/webdriver/#dfn-find-element */ findElement(locator: LocatorTypes, value: string): Promise; /** * Find elements. * @param locator The locator to use when finding the elements. * @param value The value to use with the locator. * @returns The elements if found. * @see https://w3c.github.io/webdriver/#dfn-find-elements */ findElements(locator: LocatorTypes, value: string): Promise; /** * Take a screenshot of the whole page. * @returns Returns a base64 encoded png. * @see https://w3c.github.io/webdriver/#dfn-take-screenshot */ screenshot(): Promise; /** * Perform actions on the webdriver. * @param actions The actions to perform. * @returns True if the actions were successfully performed. */ actions(actions: WebDriverAction[]): Promise; }