1 | /// <reference types="webdriverio/webdriverio-core"/>
|
2 |
|
3 | declare namespace WebdriverIO {
|
4 | function remote(
|
5 | options?: RemoteOptions,
|
6 | modifier?: (...args: any[]) => any
|
7 | ): BrowserObject;
|
8 |
|
9 | function attach(
|
10 | options: WebDriver.AttachSessionOptions,
|
11 | ): BrowserObject;
|
12 |
|
13 | function multiremote(
|
14 | options: MultiRemoteOptions
|
15 | ): BrowserObject;
|
16 |
|
17 | interface Browser {
|
18 | /**
|
19 | * execute any async action within your test spec
|
20 | */
|
21 | call: <T>(callback: (...args: any[]) => Promise<T>) => Promise<T>;
|
22 |
|
23 | /**
|
24 | * Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
25 | * The executed script is assumed to be synchronous and the result of evaluating the script is returned to
|
26 | * the client.
|
27 | */
|
28 | execute: <T>(script: string | ((...arguments: any[]) => T), ...arguments: any[]) => Promise<T>;
|
29 |
|
30 | // there is no way to add callback as last parameter after `...args`.
|
31 | // https://github.com/Microsoft/TypeScript/issues/1360
|
32 | // executeAsync: <T>(script: string | ((...arguments: any[], callback: (result: T) => void) => void), ...arguments: any[]) => Promise<T>;
|
33 | /**
|
34 | * Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
35 | * The executed script is assumed to be asynchronous and must signal that is done by invoking
|
36 | * the provided callback, which is always provided as the final argument to the function. The value
|
37 | * to this callback will be returned to the client.
|
38 | */
|
39 | executeAsync: (script: string | ((...arguments: any[]) => void), ...arguments: any[]) => Promise<any>;
|
40 | }
|
41 |
|
42 | interface BrowserObject extends WebDriver.ClientOptions, WebDriver.ClientAsync, Browser { }
|
43 | }
|
44 |
|
45 | declare var browser: WebdriverIO.BrowserObject;
|
46 | declare var driver: WebdriverIO.BrowserObject;
|
47 |
|
48 | /**
|
49 | * find a single element on the page.
|
50 | */
|
51 | declare var $: (selector: string | Function) => Promise<WebdriverIO.Element>;
|
52 |
|
53 | /**
|
54 | * find multiple elements on the page.
|
55 | */
|
56 | declare var $$: (selector: string | Function) => Promise<WebdriverIO.ElementArray>;
|
57 |
|
58 | declare module "webdriverio" {
|
59 | export = WebdriverIO
|
60 | }
|