UNPKG

2.34 kBTypeScriptView Raw
1declare module 'selenium-standalone' {
2 import * as child_process from 'child_process';
3 export interface DriverConfig {
4 version: string;
5 arch: string;
6 baseURL: string;
7 }
8 export interface InstallOpts {
9 /** Selenium version to install. */
10 version: string;
11
12 /** Used to find the server having the selenium or drivers files. */
13 baseURL?: string;
14
15 /**
16 * Sets the base directory used to store the selenium standalone .jar and
17 * drivers. Defaults to current working directory + .selenium/
18 */
19 basePath?: string;
20
21 /** Drivers to download and install along with selenium standalone server */
22 drivers?: {
23 [browserName: string]: DriverConfig;
24 // chrome?: DriverConfig;
25 // ie?: DriverConfig;
26 // ... complete list?
27 };
28
29 /**
30 * Will be called if provided with some debugging information about the
31 * installation process.
32 */
33 logger?: (message: any) => void;
34
35 progressCb?: (totalLength: number, progressLength: number, chunkLength: number) => void;
36
37 }
38 export function install(opts: InstallOpts, cb: (error?: any) => void): void;
39
40 export interface StartOpts {
41 drivers?: {
42 [browserName: string]: DriverConfig;
43 // chrome?: DriverConfig;
44 // ie?: DriverConfig;
45 // ... complete list?
46 };
47
48 /**
49 * Sets the base directory used to store the selenium standalone .jar and
50 * drivers. Defaults to current working directory + .selenium/
51 */
52 basePath?: string;
53
54 /** Spawn options for the selenium server. */
55 spawnOptions?: child_process.SpawnOptions;
56
57 /**
58 * Arguments for the selenium server, passed directly to
59 * child_process.spawn.
60 */
61 seleniumArgs?: string[];
62
63 /** seleniumJavaArgs */
64 javaArgs?: string[];
65
66 /** set the javaPath manually, otherwise we use `which` */
67 javaPath?: string;
68
69 /**
70 * Will be called if provided as soon as the selenium child process was
71 * spawned. It may be interesting if you want to do some more debug.
72 */
73 spawnCb?: Function;
74
75 /**
76 * Called when the server is running and listening, child is the
77 * ChildProcess instance created.
78 */
79 cb?: (err: any, child: child_process.ChildProcess) => void;
80 }
81 export function start(opts: StartOpts, cb: (error?: any) => void): void;
82}