UNPKG

1.92 kBTypeScriptView Raw
1
2
3declare module 'wd' {
4 interface NodeCB<T> {
5 (err: any, value: T): void;
6 }
7 export interface Browser {
8 configureHttp(options: {
9 retries: number
10 }): void;
11 attach(sessionId: string, callback: NodeCB<Capabilities>): void;
12 init(capabilities: Capabilities, callback: NodeCB<string>): void;
13
14 get(url: string, callback: NodeCB<void>): void;
15 quit(callback: NodeCB<void>): void;
16
17 on(eventName: string, handler: Function): void;
18 }
19 export interface Capabilities {
20 /** The name of the browser being used */
21 browserName: 'android'|'chrome'|'firefox'|'htmlunit'|'internet explorer'|'iPhone'|'iPad'|'opera'|'safari'|'phantomjs';
22 /** The browser version, or the empty string if unknown. */
23 version: string;
24 /** A key specifying which platform the browser should be running on. */
25 platform?: 'WINDOWS'|'XP'|'VISTA'|'MAC'|'LINUX'|'UNIX'|'ANDROID'|'ANY';
26
27 /** Whether the session can interact with modal popups,
28 * such as window.alert and window.confirm. */
29 handlesAlerts?: boolean;
30 /** Whether the session supports CSS selectors when searching for elements. */
31 cssSelectorsEnabled?: boolean;
32
33 webdriver?: {
34 remote: {
35 quietExceptions: boolean;
36 }
37 };
38
39 selenium?: {
40 server: {
41 url: string;
42 }
43 };
44
45 chromeOptions?: {
46 binary?: string;
47 args?: string[];
48 };
49 firefox_binary?: string;
50 marionette?: boolean;
51 'moz:firefoxOptions'?: {
52 args?: string[];
53 },
54 'safari.options'?: {
55 skipExtensionInstallation?: boolean;
56 };
57 'phantomjs.binary.path'?: string;
58 }
59
60 export type ValidHost =
61 string |
62 {hostname: string, port?: number,
63 auth?: string, path?: string, } |
64 {host: string, port?: number,
65 username?: string, accesskey?: string, path?: string, };
66
67 export function remote(hostnameOrUrl: ValidHost): Browser;
68}