UNPKG

8.34 kBTypeScriptView Raw
1import * as webdriver from "./index";
2import * as remote from "./remote";
3
4/**
5 * IEDriverServer logging levels.
6 */
7export type Level = "FATAL" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE";
8
9/**
10 * A WebDriver client for Microsoft's Internet Explorer.
11 */
12export class Driver extends webdriver.WebDriver {
13 /**
14 * Creates a new session for Microsoft's Internet Explorer.
15 *
16 * @param {(Capabilities|Options)=} options The configuration options.
17 * @param {(remote.DriverService)=} opt_service The `DriverService` to use
18 * to start the IEDriverServer in a child process, optionally.
19 * @return {!Driver} A new driver instance.
20 */
21 static createSession(
22 options?: webdriver.Capabilities | Options,
23 opt_service?: remote.DriverService,
24 ): Driver;
25
26 /**
27 * This function is a no-op as file detectors are not supported by this
28 * implementation.
29 * @override
30 */
31 setFileDetector(): void;
32}
33
34/**
35 * Class for managing IEDriver specific options.
36 */
37export class Options extends webdriver.Capabilities {
38 constructor();
39
40 /**
41 * Whether to disable the protected mode settings check when the session is
42 * created. Disbling this setting may lead to significant instability as the
43 * browser may become unresponsive/hang. Only 'best effort' support is
44 * provided when using this capability.
45 *
46 * For more information, refer to the IEDriver's
47 * [required system configuration](http://goo.gl/eH0Yi3).
48 *
49 * @param {boolean} ignoreSettings Whether to ignore protected mode settings.
50 * @return {!Options} A self reference.
51 */
52 introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings: boolean): Options;
53
54 /**
55 * Indicates whether to skip the check that the browser's zoom level is set to
56 * 100%.
57 *
58 * @param {boolean} ignore Whether to ignore the browser's zoom level
59 * settings.
60 * @return {!Options} A self reference.
61 */
62 ignoreZoomSetting(ignore: boolean): Options;
63
64 /**
65 * Sets the initial URL loaded when IE starts. This is intended to be used
66 * with
67 * {@link #ignoreProtectedModeSettings} to allow the user to initialize IE in
68 * the proper Protected Mode zone. Setting this option may cause browser
69 * instability or flaky and unresponsive code. Only 'best effort' support is
70 * provided when using this option.
71 *
72 * @param {string} url The initial browser URL.
73 * @return {!Options} A self reference.
74 */
75 initialBrowserUrl(url: string): Options;
76
77 /**
78 * Configures whether to enable persistent mouse hovering (true by default).
79 * Persistent hovering is achieved by continuously firing mouse over events at
80 * the last location the mouse cursor has been moved to.
81 *
82 * @param {boolean} enable Whether to enable persistent hovering.
83 * @return {!Options} A self reference.
84 */
85 enablePersistentHover(enable: boolean): Options;
86
87 /**
88 * Configures whether the driver should attempt to remove obsolete
89 * {@linkplain webdriver.WebElement WebElements} from its internal cache on
90 * page navigation (true by default). Disabling this option will cause the
91 * driver to run with a larger memory footprint.
92 *
93 * @param {boolean} enable Whether to enable element reference cleanup.
94 * @return {!Options} A self reference.
95 */
96 enableElementCacheCleanup(enable: boolean): Options;
97
98 /**
99 * Configures whether to require the IE window to have input focus before
100 * performing any user interactions (i.e. mouse or keyboard events). This
101 * option is disabled by default, but delivers much more accurate interaction
102 * events when enabled.
103 *
104 * @param {boolean} require Whether to require window focus.
105 * @return {!Options} A self reference.
106 */
107 requireWindowFocus(require: boolean): Options;
108
109 /**
110 * Configures the timeout, in milliseconds, that the driver will attempt to
111 * located and attach to a newly opened instance of Internet Explorer. The
112 * default is zero, which indicates waiting indefinitely.
113 *
114 * @param {number} timeout How long to wait for IE.
115 * @return {!Options} A self reference.
116 */
117 browserAttachTimeout(timeout: number): Options;
118
119 /**
120 * Configures whether to launch Internet Explorer using the CreateProcess API.
121 * If this option is not specified, IE is launched using IELaunchURL, if
122 * available. For IE 8 and above, this option requires the TabProcGrowth
123 * registry value to be set to 0.
124 *
125 * @param {boolean} force Whether to use the CreateProcess API.
126 * @return {!Options} A self reference.
127 */
128 forceCreateProcessApi(force: boolean): Options;
129
130 /**
131 * Specifies command-line switches to use when launching Internet Explorer.
132 * This is only valid when used with {@link #forceCreateProcessApi}.
133 *
134 * @param {...(string|!Array.<string>)} var_args The arguments to add.
135 * @return {!Options} A self reference.
136 */
137 addArguments(...var_args: string[]): Options;
138
139 /**
140 * Configures whether proxies should be configured on a per-process basis. If
141 * not set, setting a {@linkplain #setProxy proxy} will configure the system
142 * proxy. The default behavior is to use the system proxy.
143 *
144 * @param {boolean} enable Whether to enable per-process proxy settings.
145 * @return {!Options} A self reference.
146 */
147 usePerProcessProxy(enable: boolean): Options;
148
149 /**
150 * Configures whether to clear the cache, cookies, history, and saved form
151 * data before starting the browser. _Using this capability will clear session
152 * data for all running instances of Internet Explorer, including those
153 * started manually._
154 *
155 * @param {boolean} cleanSession Whether to clear all session data on startup.
156 * @return {!Options} A self reference.
157 */
158 ensureCleanSession(cleanSession: boolean): Options;
159
160 /**
161 * Sets the path to the log file the driver should log to.
162 * @param {string} file The log file path.
163 * @return {!Options} A self reference.
164 */
165 setLogFile(file: string): Options;
166
167 /**
168 * Sets the IEDriverServer's logging {@linkplain Level level}.
169 * @param {Level} level The logging level.
170 * @return {!Options} A self reference.
171 */
172 setLogLevel(level: Level): Options;
173
174 /**
175 * Sets the IP address of the driver's host adapter.
176 * @param {string} host The IP address to use.
177 * @return {!Options} A self reference.
178 */
179 setHost(host: string): Options;
180
181 /**
182 * Sets the path of the temporary data directory to use.
183 * @param {string} path The log file path.
184 * @return {!Options} A self reference.
185 */
186 setExtractPath(path: string): Options;
187
188 /**
189 * Sets whether the driver should start in silent mode.
190 * @param {boolean} silent Whether to run in silent mode.
191 * @return {!Options} A self reference.
192 */
193 silent(silent: boolean): Options;
194
195 /**
196 * Sets the proxy settings for the new session.
197 * @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
198 * @return {!Options} A self reference.
199 */
200 setProxy(proxy: webdriver.ProxyConfig): Options;
201
202 /**
203 * Sets the IEDriver to drive Chromium-based Edge in Internet Explorer mode.
204 * @param {boolean} attachEdgeChromium Whether to run in Chromium-based-Edge in IE mode
205 * @return {!Options} A self reference.
206 */
207 setEdgeChromium(attachEdgeChromium: boolean): Options;
208
209 /**
210 * Sets the path of the EdgeChromium driver.
211 * @param {string} path The EdgeChromium driver path
212 * @return {!Options} A self reference.
213 */
214 setEdgePath(path: string): Options;
215}
216
217/**
218 * Creates {@link selenium-webdriver/remote.DriverService} instances that manage
219 * an [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
220 * server in a child process.
221 */
222export class ServiceBuilder extends remote.DriverService.Builder {
223 /**
224 * @param {string=} opt_exe Path to the server executable to use. If omitted,
225 * the builder will attempt to locate the IEDriverServer on the system PATH.
226 */
227 constructor(opt_exe?: string);
228}
229
\No newline at end of file