UNPKG

3.7 kBTypeScriptView Raw
1import * as http from "./http";
2import * as webdriver from "./index";
3import * as remote from "./remote";
4
5/**
6 * Creates a new WebDriver client for Chrome.
7 */
8export class Driver extends webdriver.chromium.ChromiumWebDriver {
9 /**
10 * Creates a new session with the ChromeDriver.
11 *
12 * @param {(Capabilities|Options)=} opt_config The configuration options.
13 * @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either
14 * a DriverService to use for the remote end, or a preconfigured executor
15 * for an externally managed endpoint. If neither is provided, the
16 * {@linkplain ##getDefaultService default service} will be used by
17 * default.
18 * @return {!Driver} A new driver instance.
19 */
20 static createSession(
21 opt_config?: Options | webdriver.Capabilities,
22 opt_serviceExecutor?: remote.DriverService | http.Executor,
23 ): Driver;
24
25 /**
26 * returns new instance chrome driver service
27 * @returns {remote.DriverService}
28 */
29 static getDefaultService(): remote.DriverService;
30}
31
32export interface IOptionsValues {
33 args: string[];
34 binary?: string | undefined;
35 detach: boolean;
36 extensions: string[];
37 localState?: any;
38 logFile?: string | undefined;
39 prefs?: any;
40}
41
42export interface IPerfLoggingPrefs {
43 enableNetwork?: boolean | undefined;
44 enablePage?: boolean | undefined;
45 enableTimeline?: boolean | undefined;
46 traceCategories?: string | undefined;
47 bufferUsageReportingInterval?: number | undefined;
48}
49
50/**
51 * Class for managing ChromeDriver specific options.
52 */
53export class Options extends webdriver.chromium.Options {
54 /**
55 * Sets the path to the Chrome binary to use. On Mac OS X, this path should
56 * reference the actual Chrome executable, not just the application binary
57 * (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').
58 *
59 * The binary path be absolute or relative to the chromedriver server
60 * executable, but it must exist on the machine that will launch Chrome.
61 *
62 * @param {string} path The path to the Chrome binary to use.
63 * @return {!Options} A self reference.
64 */
65 setChromeBinaryPath(path: string): Options;
66
67 /**
68 * Configures the ChromeDriver to launch Chrome on Android via adb. This
69 * function is shorthand for
70 * {@link #androidPackage options.androidPackage('com.android.chrome')}.
71 * @return {!Options} A self reference.
72 */
73 androidChrome(): Options;
74
75 /**
76 * Sets the path to Chrome's log file. This path should exist on the machine
77 * that will launch Chrome.
78 * @param {string} path Path to the log file to use.
79 * @return {!Options} A self reference.
80 */
81 setChromeLogFile(path: string): Options;
82
83 /**
84 * Sets the directory to store Chrome minidumps in. This option is only
85 * supported when ChromeDriver is running on Linux.
86 * @param {string} path The directory path.
87 * @return {!Options} A self reference.
88 */
89 setChromeMinidumpPath(path: string): Options;
90}
91
92/**
93 * Creates {@link selenium-webdriver/remote.DriverService} instances that manage
94 * a [ChromeDriver](https://chromedriver.chromium.org/)
95 * server in a child process.
96 */
97export class ServiceBuilder extends webdriver.chromium.ServiceBuilder {
98 /**
99 * @param {string=} opt_exe Path to the server executable to use. If omitted,
100 * the builder will attempt to locate the chromedriver on the current
101 * PATH.
102 * @throws {Error} If provided executable does not exist, or the chromedriver
103 * cannot be found on the PATH.
104 */
105 constructor(opt_exe?: string);
106}