UNPKG

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