selenium-webdriver 3.6.0 → 4.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGES.md +181 -0
  2. package/README.md +25 -27
  3. package/chrome.js +113 -127
  4. package/edge.js +42 -117
  5. package/example/chrome_android.js +8 -8
  6. package/example/chrome_mobile_emulation.js +8 -8
  7. package/example/firefox_channels.js +22 -18
  8. package/example/google_search_test.js +39 -26
  9. package/example/logging.js +39 -6
  10. package/firefox.js +769 -0
  11. package/http/index.js +41 -4
  12. package/http/util.js +11 -6
  13. package/ie.js +56 -97
  14. package/index.js +178 -114
  15. package/jasmine.json +11 -0
  16. package/lib/actions.js +68 -63
  17. package/lib/by.js +1 -1
  18. package/lib/capabilities.js +255 -192
  19. package/lib/command.js +26 -50
  20. package/lib/error.js +85 -44
  21. package/lib/http.js +133 -110
  22. package/lib/input.js +1044 -8
  23. package/lib/promise.js +222 -3323
  24. package/lib/proxy.js +134 -39
  25. package/lib/test/bootstrap_jasmine.js +28 -0
  26. package/lib/test/data/actions/click.html +24 -0
  27. package/lib/test/data/actions/drag.html +77 -0
  28. package/lib/test/data/actions/record_click.html +21 -0
  29. package/lib/test/data/chrome/download.html +2 -0
  30. package/lib/test/data/inputs.html +42 -0
  31. package/lib/test/data/selectPage.html +12 -0
  32. package/lib/test/data/simpleTest.html +5 -0
  33. package/lib/test/data/upload_invisible.html +45 -0
  34. package/lib/test/fileserver.js +23 -19
  35. package/lib/test/index.js +30 -212
  36. package/lib/test/resources.js +0 -1
  37. package/lib/webdriver.js +675 -936
  38. package/net/index.js +21 -25
  39. package/net/portprober.js +51 -68
  40. package/package.json +5 -3
  41. package/remote/index.js +5 -19
  42. package/safari.js +41 -128
  43. package/test/actions_test.js +173 -18
  44. package/test/{session_test.js → builder_test.js} +44 -37
  45. package/test/chrome/devtools_test.js +93 -0
  46. package/test/chrome/options_test.js +48 -154
  47. package/test/chrome/service_test.js +7 -7
  48. package/test/cookie_test.js +77 -63
  49. package/test/element_finding_test.js +206 -201
  50. package/test/execute_script_test.js +115 -114
  51. package/test/fingerprint_test.js +16 -15
  52. package/test/firefox_test.js +251 -0
  53. package/test/http/http_test.js +0 -1
  54. package/test/http/util_test.js +2 -2
  55. package/test/io/zip_test.js +6 -7
  56. package/test/lib/error_test.js +34 -7
  57. package/test/lib/http_test.js +8 -128
  58. package/test/lib/input_test.js +1379 -0
  59. package/test/lib/promise_test.js +473 -908
  60. package/test/lib/webdriver_test.js +296 -868
  61. package/test/logging_test.js +37 -43
  62. package/test/page_loading_test.js +71 -81
  63. package/test/proxy_test.js +64 -72
  64. package/test/rect_test.js +14 -25
  65. package/test/remote_test.js +10 -29
  66. package/test/safari_test.js +7 -71
  67. package/test/stale_element_test.js +20 -23
  68. package/test/tag_name_test.js +10 -9
  69. package/test/upload_test.js +27 -35
  70. package/test/window_test.js +72 -85
  71. package/testing/index.js +386 -314
  72. package/.npmignore +0 -2
  73. package/example/async_await_test.js +0 -69
  74. package/example/google_search_generator.js +0 -47
  75. package/example/parallel_flows.js +0 -51
  76. package/firefox/binary.js +0 -347
  77. package/firefox/extension.js +0 -224
  78. package/firefox/index.js +0 -576
  79. package/firefox/profile.js +0 -311
  80. package/lib/events.js +0 -210
  81. package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
  82. package/lib/test/data/firefox/sample.xpi +0 -0
  83. package/lib/test/promise.js +0 -79
  84. package/opera.js +0 -405
  85. package/phantomjs.js +0 -282
  86. package/test/firefox/extension_test.js +0 -120
  87. package/test/firefox/firefox_test.js +0 -244
  88. package/test/firefox/profile_test.js +0 -140
  89. package/test/lib/events_test.js +0 -177
  90. package/test/lib/promise_aplus_test.js +0 -78
  91. package/test/lib/promise_error_test.js +0 -884
  92. package/test/lib/promise_flow_test.js +0 -2288
  93. package/test/lib/promise_generator_test.js +0 -310
  94. package/test/phantomjs/execute_phantomjs_test.js +0 -59
  95. package/test/testing/assert_test.js +0 -373
  96. package/test/testing/index_test.js +0 -224
  97. package/testing/assert.js +0 -378
@@ -22,6 +22,7 @@
22
22
  * WebDriver session.
23
23
  */
24
24
 
25
+ const proxy = require('./proxy');
25
26
  const Symbols = require('./symbols');
26
27
 
27
28
 
@@ -30,161 +31,190 @@ const Symbols = require('./symbols');
30
31
  * @enum {string}
31
32
  */
32
33
  const Browser = {
33
- ANDROID: 'android',
34
34
  CHROME: 'chrome',
35
35
  EDGE: 'MicrosoftEdge',
36
36
  FIREFOX: 'firefox',
37
37
  IE: 'internet explorer',
38
38
  INTERNET_EXPLORER: 'internet explorer',
39
- IPAD: 'iPad',
40
- IPHONE: 'iPhone',
41
- OPERA: 'opera',
42
- PHANTOM_JS: 'phantomjs',
43
39
  SAFARI: 'safari',
44
- HTMLUNIT: 'htmlunit'
45
40
  };
46
41
 
47
42
 
48
43
  /**
49
- * Common Capability keys.
44
+ * Strategies for waiting for [document readiness] after a navigation
45
+ * event.
46
+ *
47
+ * [document readiness]: https://html.spec.whatwg.org/#current-document-readiness
48
+ *
50
49
  * @enum {string}
51
50
  */
52
- const Capability = {
51
+ const PageLoadStrategy = {
52
+ /**
53
+ * Indicates WebDriver should not wait on the document readiness state after a
54
+ * navigation event.
55
+ */
56
+ NONE: 'none',
53
57
 
54
58
  /**
55
- * Indicates whether a driver should accept all SSL certs by default. This
56
- * capability only applies when requesting a new session. To query whether
57
- * a driver can handle insecure SSL certs, see {@link #SECURE_SSL}.
59
+ * Indicates WebDriver should wait for the document readiness state to
60
+ * become "interactive" after navigation.
58
61
  */
59
- ACCEPT_SSL_CERTS: 'acceptSslCerts',
62
+ EAGER: 'eager',
60
63
 
64
+ /**
65
+ * Indicates WebDriver should wait for the document readiness state to
66
+ * be "complete" after navigation. This is the default page loading strategy.
67
+ */
68
+ NORMAL: 'normal'
69
+ };
70
+
71
+
72
+ /**
73
+ * Common platform names. These platforms are not explicitly defined by the
74
+ * WebDriver spec, however, their use is encouraged for interoperability.
75
+ *
76
+ * @enum {string}
77
+ * @see <https://w3c.github.io/webdriver/webdriver-spec.html>
78
+ */
79
+ const Platform = {
80
+ LINUX: 'linux',
81
+ MAC: 'mac',
82
+ WINDOWS: 'windows'
83
+ };
84
+
85
+
86
+ /**
87
+ * Record object defining the timeouts that apply to certain WebDriver actions.
88
+ *
89
+ * @record
90
+ */
91
+ function Timeouts() {}
61
92
 
93
+ /**
94
+ * Defines when, in milliseconds, to interupt a script that is being
95
+ * {@linkplain ./webdriver.IWebDriver#executeScript evaluated}.
96
+ * @type {number}
97
+ */
98
+ Timeouts.prototype.script;
99
+
100
+ /**
101
+ * The timeout, in milliseconds, to apply to navigation events along with the
102
+ * {@link PageLoadStrategy}.
103
+ * @type {number}
104
+ */
105
+ Timeouts.prototype.pageLoad;
106
+
107
+ /**
108
+ * The maximimum amount of time, in milliseconds, to spend attempting to
109
+ * {@linkplain ./webdriver.IWebDriver#findElement locate} an element on the
110
+ * current page.
111
+ * @type {number}
112
+ */
113
+ Timeouts.prototype.implicit;
114
+
115
+
116
+ /**
117
+ * The possible default actions a WebDriver session can take to respond to
118
+ * unhandled user prompts (`window.alert()`, `window.confirm()`, and
119
+ * `window.prompt()`).
120
+ *
121
+ * @enum {string}
122
+ */
123
+ const UserPromptHandler = {
124
+ /** All prompts should be silently accepted. */
125
+ ACCEPT: 'accept',
126
+ /** All prompts should be silently dismissed. */
127
+ DISMISS: 'dismiss',
62
128
  /**
63
- * The browser name. Common browser names are defined in the {@link Browser}
64
- * enum.
129
+ * All prompts should be automatically accepted, but an error should be
130
+ * returned to the next (or currently executing) WebDriver command.
65
131
  */
66
- BROWSER_NAME: 'browserName',
132
+ ACCEPT_AND_NOTIFY: 'accept and notify',
133
+ /**
134
+ * All prompts should be automatically dismissed, but an error should be
135
+ * returned to the next (or currently executing) WebDriver command.
136
+ */
137
+ DISMISS_AND_NOTIFY: 'dismiss and notify',
138
+ /** All prompts should be left unhandled. */
139
+ IGNORE: 'ignore'
140
+ };
141
+
142
+
143
+ /**
144
+ * The standard WebDriver capability keys.
145
+ *
146
+ * @enum {string}
147
+ * @see <https://w3c.github.io/webdriver/webdriver-spec.html#capabilities>
148
+ */
149
+ const Capability = {
67
150
 
68
151
  /**
69
- * Defines how elements should be scrolled into the viewport for interaction.
70
- * This capability will be set to zero (0) if elements are aligned with the
71
- * top of the viewport, or one (1) if aligned with the bottom. The default
72
- * behavior is to align with the top of the viewport.
152
+ * Indicates whether a WebDriver session implicity trusts otherwise untrusted
153
+ * and self-signed TLS certificates during navigation.
73
154
  */
74
- ELEMENT_SCROLL_BEHAVIOR: 'elementScrollBehavior',
155
+ ACCEPT_INSECURE_TLS_CERTS: 'acceptInsecureCerts',
75
156
 
76
157
  /**
77
- * Whether the driver is capable of handling modal alerts (e.g. alert,
78
- * confirm, prompt). To define how a driver <i>should</i> handle alerts,
79
- * use {@link #UNEXPECTED_ALERT_BEHAVIOR}.
158
+ * The browser name. Common browser names are defined in the
159
+ * {@link ./capabilities.Browser Browser} enum.
80
160
  */
81
- HANDLES_ALERTS: 'handlesAlerts',
161
+ BROWSER_NAME: 'browserName',
162
+
163
+ /** Identifies the browser version. */
164
+ BROWSER_VERSION: 'browserVersion',
82
165
 
83
166
  /**
84
167
  * Key for the logging driver logging preferences.
168
+ * The browser name. Common browser names are defined in the
169
+ * {@link ./capabilities.Browser Browser} enum.
85
170
  */
86
171
  LOGGING_PREFS: 'loggingPrefs',
87
172
 
88
173
  /**
89
- * Whether this session generates native events when simulating user input.
174
+ * Defines the session's
175
+ * {@linkplain ./capabilities.PageLoadStrategy page loading strategy}.
90
176
  */
91
- NATIVE_EVENTS: 'nativeEvents',
177
+ PAGE_LOAD_STRATEGY: 'pageLoadStrategy',
92
178
 
93
179
  /**
94
- * Describes the platform the browser is running on. Will be one of
95
- * ANDROID, IOS, LINUX, MAC, UNIX, or WINDOWS. When <i>requesting</i> a
96
- * session, ANY may be used to indicate no platform preference (this is
97
- * semantically equivalent to omitting the platform capability).
180
+ * Identifies the operating system of the endpoint node. Common values
181
+ * recognized by the most WebDriver server implementations are predefined in
182
+ * the {@link ./capabilities.Platform Platform} enum.
98
183
  */
99
- PLATFORM: 'platform',
184
+ PLATFORM_NAME: 'platformName',
100
185
 
101
186
  /**
102
187
  * Describes the proxy configuration to use for a new WebDriver session.
103
188
  */
104
189
  PROXY: 'proxy',
105
190
 
106
- /** Whether the driver supports changing the browser's orientation. */
107
- ROTATABLE: 'rotatable',
108
-
109
191
  /**
110
- * Whether a driver is only capable of handling secure SSL certs. To request
111
- * that a driver accept insecure SSL certs by default, use
112
- * {@link #ACCEPT_SSL_CERTS}.
192
+ * Indicates whether the remote end supports all of the window resizing and
193
+ * positioning commands:
194
+ *
195
+ * - {@linkplain ./webdriver.Window#getRect Window.getRect()}
196
+ * - {@linkplain ./webdriver.Window#setRect Window.setRect()}
197
+ * - {@linkplain ./webdriver.Window#maximize Window.maximize()}
198
+ * - {@linkplain ./webdriver.Window#minimize Window.minimize()}
199
+ * - {@linkplain ./webdriver.Window#fullscreen Window.fullscreen()}
113
200
  */
114
- SECURE_SSL: 'secureSsl',
115
-
116
- /** Whether the driver supports manipulating the app cache. */
117
- SUPPORTS_APPLICATION_CACHE: 'applicationCacheEnabled',
118
-
119
- /** Whether the driver supports locating elements with CSS selectors. */
120
- SUPPORTS_CSS_SELECTORS: 'cssSelectorsEnabled',
121
-
122
- /** Whether the browser supports JavaScript. */
123
- SUPPORTS_JAVASCRIPT: 'javascriptEnabled',
124
-
125
- /** Whether the driver supports controlling the browser's location info. */
126
- SUPPORTS_LOCATION_CONTEXT: 'locationContextEnabled',
127
-
128
- /** Whether the driver supports taking screenshots. */
129
- TAKES_SCREENSHOT: 'takesScreenshot',
201
+ SET_WINDOW_RECT: 'setWindowRect',
130
202
 
131
203
  /**
132
- * Defines how the driver should handle unexpected alerts. The value should
133
- * be one of "accept", "dismiss", or "ignore".
204
+ * Describes the {@linkplain ./capabilities.Timeouts timeouts} imposed on
205
+ * certain session operations.
134
206
  */
135
- UNEXPECTED_ALERT_BEHAVIOR: 'unexpectedAlertBehaviour',
207
+ TIMEOUTS: 'timeouts',
136
208
 
137
- /** Defines the browser version. */
138
- VERSION: 'version'
209
+ /**
210
+ * Defines how a WebDriver session should
211
+ * {@linkplain ./capabilities.UserPromptHandler respond} to unhandled user
212
+ * prompts.
213
+ */
214
+ UNHANDLED_PROMPT_BEHAVIOR: 'unhandledPromptBehavior',
139
215
  };
140
216
 
141
217
 
142
- /**
143
- * Describes how a proxy should be configured for a WebDriver session.
144
- * @record
145
- */
146
- function ProxyConfig() {}
147
-
148
- /**
149
- * The proxy type. Must be one of {"manual", "pac", "system"}.
150
- * @type {string}
151
- */
152
- ProxyConfig.prototype.proxyType;
153
-
154
- /**
155
- * URL for the PAC file to use. Only used if {@link #proxyType} is "pac".
156
- * @type {(string|undefined)}
157
- */
158
- ProxyConfig.prototype.proxyAutoconfigUrl;
159
-
160
- /**
161
- * The proxy host for FTP requests. Only used if {@link #proxyType} is "manual".
162
- * @type {(string|undefined)}
163
- */
164
- ProxyConfig.prototype.ftpProxy;
165
-
166
- /**
167
- * The proxy host for HTTP requests. Only used if {@link #proxyType} is
168
- * "manual".
169
- * @type {(string|undefined)}
170
- */
171
- ProxyConfig.prototype.httpProxy;
172
-
173
- /**
174
- * The proxy host for HTTPS requests. Only used if {@link #proxyType} is
175
- * "manual".
176
- * @type {(string|undefined)}
177
- */
178
- ProxyConfig.prototype.sslProxy;
179
-
180
- /**
181
- * A comma delimited list of hosts which should bypass all proxies. Only used if
182
- * {@link #proxyType} is "manual".
183
- * @type {(string|undefined)}
184
- */
185
- ProxyConfig.prototype.noProxy;
186
-
187
-
188
218
  /**
189
219
  * Converts a generic hash object to a map.
190
220
  * @param {!Object<string, ?>} hash The hash object.
@@ -219,100 +249,39 @@ class Capabilities {
219
249
  this.map_ = new Map(other);
220
250
  }
221
251
 
222
- /**
223
- * @return {!Capabilities} A basic set of capabilities for Android.
224
- */
225
- static android() {
226
- return new Capabilities()
227
- .set(Capability.BROWSER_NAME, Browser.ANDROID);
228
- }
229
-
230
252
  /**
231
253
  * @return {!Capabilities} A basic set of capabilities for Chrome.
232
254
  */
233
255
  static chrome() {
234
- return new Capabilities().set(Capability.BROWSER_NAME, Browser.CHROME);
256
+ return new Capabilities().setBrowserName(Browser.CHROME);
235
257
  }
236
258
 
237
259
  /**
238
260
  * @return {!Capabilities} A basic set of capabilities for Microsoft Edge.
239
261
  */
240
262
  static edge() {
241
- return new Capabilities()
242
- .set(Capability.BROWSER_NAME, Browser.EDGE);
263
+ return new Capabilities().setBrowserName(Browser.EDGE);
243
264
  }
244
265
 
245
266
  /**
246
267
  * @return {!Capabilities} A basic set of capabilities for Firefox.
247
268
  */
248
269
  static firefox() {
249
- return new Capabilities().set(Capability.BROWSER_NAME, Browser.FIREFOX);
270
+ return new Capabilities().setBrowserName(Browser.FIREFOX);
250
271
  }
251
272
 
252
273
  /**
253
274
  * @return {!Capabilities} A basic set of capabilities for Internet Explorer.
254
275
  */
255
276
  static ie() {
256
- return new Capabilities().
257
- set(Capability.BROWSER_NAME, Browser.INTERNET_EXPLORER);
258
- }
259
-
260
- /**
261
- * @return {!Capabilities} A basic set of capabilities for iPad.
262
- */
263
- static ipad() {
264
- return new Capabilities().
265
- set(Capability.BROWSER_NAME, Browser.IPAD);
266
- }
267
-
268
- /**
269
- * @return {!Capabilities} A basic set of capabilities for iPhone.
270
- */
271
- static iphone() {
272
- return new Capabilities().
273
- set(Capability.BROWSER_NAME, Browser.IPHONE);
274
- }
275
-
276
- /**
277
- * @return {!Capabilities} A basic set of capabilities for Opera.
278
- */
279
- static opera() {
280
- return new Capabilities().
281
- set(Capability.BROWSER_NAME, Browser.OPERA);
282
- }
283
-
284
- /**
285
- * @return {!Capabilities} A basic set of capabilities for PhantomJS.
286
- */
287
- static phantomjs() {
288
- return new Capabilities().
289
- set(Capability.BROWSER_NAME, Browser.PHANTOM_JS);
277
+ return new Capabilities().setBrowserName(Browser.INTERNET_EXPLORER);
290
278
  }
291
279
 
292
280
  /**
293
281
  * @return {!Capabilities} A basic set of capabilities for Safari.
294
282
  */
295
283
  static safari() {
296
- return new Capabilities().
297
- set(Capability.BROWSER_NAME, Browser.SAFARI);
298
- }
299
-
300
- /**
301
- * @return {!Capabilities} A basic set of capabilities for HTMLUnit.
302
- */
303
- static htmlunit() {
304
- return new Capabilities().
305
- set(Capability.BROWSER_NAME, Browser.HTMLUNIT);
306
- }
307
-
308
- /**
309
- * @return {!Capabilities} A basic set of capabilities for HTMLUnit
310
- * with enabled Javascript.
311
- */
312
- static htmlunitwithjs() {
313
- return new Capabilities().
314
- set(Capability.BROWSER_NAME, Browser.HTMLUNIT).
315
- set(Capability.SUPPORTS_JAVASCRIPT, true);
284
+ return new Capabilities().setBrowserName(Browser.SAFARI);
316
285
  }
317
286
 
318
287
  /**
@@ -404,6 +373,98 @@ class Capabilities {
404
373
  return this;
405
374
  }
406
375
 
376
+ /**
377
+ * Sets whether a WebDriver session should implicitly accept self-signed, or
378
+ * other untrusted TLS certificates on navigation.
379
+ *
380
+ * @param {boolean} accept whether to accept insecure certs.
381
+ * @return {!Capabilities} a self reference.
382
+ */
383
+ setAcceptInsecureCerts(accept) {
384
+ return this.set(Capability.ACCEPT_INSECURE_TLS_CERTS, accept);
385
+ }
386
+
387
+ /**
388
+ * @return {boolean} whether the session is configured to accept insecure
389
+ * TLS certificates.
390
+ */
391
+ getAcceptInsecureCerts() {
392
+ return this.get(Capability.ACCEPT_INSECURE_TLS_CERTS);
393
+ }
394
+
395
+ /**
396
+ * Sets the name of the target browser.
397
+ *
398
+ * @param {(Browser|string)} name the browser name.
399
+ * @return {!Capabilities} a self reference.
400
+ */
401
+ setBrowserName(name) {
402
+ return this.set(Capability.BROWSER_NAME, name);
403
+ }
404
+
405
+ /**
406
+ * @return {(string|undefined)} the configured browser name, or undefined if
407
+ * not set.
408
+ */
409
+ getBrowserName() {
410
+ return this.get(Capability.BROWSER_NAME);
411
+ }
412
+
413
+ /**
414
+ * Sets the desired version of the target browser.
415
+ *
416
+ * @param {string} version the desired version.
417
+ * @return {!Capabilities} a self reference.
418
+ */
419
+ setBrowserVersion(version) {
420
+ return this.set(Capability.BROWSER_VERSION, version);
421
+ }
422
+
423
+ /**
424
+ * @return {(string|undefined)} the configured browser version, or undefined
425
+ * if not set.
426
+ */
427
+ getBrowserVersion() {
428
+ return this.get(Capability.BROWSER_VERSION);
429
+ }
430
+
431
+ /**
432
+ * Sets the desired page loading strategy for a new WebDriver session.
433
+ *
434
+ * @param {PageLoadStrategy} strategy the desired strategy.
435
+ * @return {!Capabilities} a self reference.
436
+ */
437
+ setPageLoadStrategy(strategy) {
438
+ return this.set(Capability.PAGE_LOAD_STRATEGY, strategy);
439
+ }
440
+
441
+ /**
442
+ * Returns the configured page load strategy.
443
+ *
444
+ * @return {(string|undefined)} the page load strategy.
445
+ */
446
+ getPageLoadStrategy() {
447
+ return this.get(Capability.PAGE_LOAD_STRATEGY);
448
+ }
449
+
450
+ /**
451
+ * Sets the target platform.
452
+ *
453
+ * @param {(Platform|string)} platform the target platform.
454
+ * @return {!Capabilities} a self reference.
455
+ */
456
+ setPlatform(platform) {
457
+ return this.set(Capability.PLATFORM_NAME, platform);
458
+ }
459
+
460
+ /**
461
+ * @return {(string|undefined)} the configured platform or undefined if not
462
+ * set.
463
+ */
464
+ getPlatform() {
465
+ return this.get(Capability.PLATFORM_NAME);
466
+ }
467
+
407
468
  /**
408
469
  * Sets the logging preferences. Preferences may be specified as a
409
470
  * {@link ./logging.Preferences} instance, or as a map of log-type to
@@ -418,7 +479,7 @@ class Capabilities {
418
479
 
419
480
  /**
420
481
  * Sets the proxy configuration for this instance.
421
- * @param {ProxyConfig} proxy The desired proxy configuration.
482
+ * @param {proxy.Config} proxy The desired proxy configuration.
422
483
  * @return {!Capabilities} A self reference.
423
484
  */
424
485
  setProxy(proxy) {
@@ -426,33 +487,32 @@ class Capabilities {
426
487
  }
427
488
 
428
489
  /**
429
- * Sets whether native events should be used.
430
- * @param {boolean} enabled Whether to enable native events.
431
- * @return {!Capabilities} A self reference.
490
+ * @return {(proxy.Config|undefined)} the configured proxy settings, or
491
+ * undefined if not set.
432
492
  */
433
- setEnableNativeEvents(enabled) {
434
- return this.set(Capability.NATIVE_EVENTS, enabled);
493
+ getProxy() {
494
+ return this.get(Capability.PROXY);
435
495
  }
436
496
 
437
497
  /**
438
- * Sets how elements should be scrolled into view for interaction.
439
- * @param {number} behavior The desired scroll behavior: either 0 to align
440
- * with the top of the viewport or 1 to align with the bottom.
498
+ * Sets the default action to take with an unexpected alert before returning
499
+ * an error. If unspecified, WebDriver will default to
500
+ * {@link UserPromptHandler.DISMISS_AND_NOTIFY}.
501
+ *
502
+ * @param {?UserPromptHandler} behavior The way WebDriver should respond to
503
+ * unhandled user prompts.
441
504
  * @return {!Capabilities} A self reference.
442
505
  */
443
- setScrollBehavior(behavior) {
444
- return this.set(Capability.ELEMENT_SCROLL_BEHAVIOR, behavior);
506
+ setAlertBehavior(behavior) {
507
+ return this.set(Capability.UNHANDLED_PROMPT_BEHAVIOR, behavior);
445
508
  }
446
509
 
447
510
  /**
448
- * Sets the default action to take with an unexpected alert before returning
449
- * an error.
450
- * @param {string} behavior The desired behavior should be "accept",
451
- * "dismiss", or "ignore". Defaults to "dismiss".
452
- * @return {!Capabilities} A self reference.
511
+ * @return {(UserPromptHandler|undefined)} the behavior pattern for responding
512
+ * to unhandled user prompts, or undefined if not set.
453
513
  */
454
- setAlertBehavior(behavior) {
455
- return this.set(Capability.UNEXPECTED_ALERT_BEHAVIOR, behavior);
514
+ getAlertBehavior() {
515
+ return this.get(Capability.UNHANDLED_PROMPT_BEHAVIOR);
456
516
  }
457
517
  }
458
518
 
@@ -482,8 +542,11 @@ function serialize(caps) {
482
542
 
483
543
 
484
544
  module.exports = {
485
- Browser: Browser,
486
- Capabilities: Capabilities,
487
- Capability: Capability,
488
- ProxyConfig: ProxyConfig
545
+ Browser,
546
+ Capabilities,
547
+ Capability,
548
+ PageLoadStrategy,
549
+ Platform,
550
+ Timeouts,
551
+ UserPromptHandler,
489
552
  };