File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 21
21
The top-level ` error ` module will be removed in v3.0.
22
22
* Moved ` until.Condition ` and ` until.WebElementCondition ` to the webdriver
23
23
module to break a circular dependency.
24
+ * Added support for setting the username and password in basic auth pop-up
25
+ dialogs (currently IE only).
24
26
* FIXED: ` io.findInPath() ` will no longer match against directories that have
25
27
the same basename as the target file.
26
28
* FIXED: ` phantomjs.Driver ` now takes a third argument that defines the path to
Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ const COMMAND_MAP = new Map([
189
189
[ cmd . Name . DISMISS_ALERT , post ( '/session/:sessionId/dismiss_alert' ) ] ,
190
190
[ cmd . Name . GET_ALERT_TEXT , get ( '/session/:sessionId/alert_text' ) ] ,
191
191
[ cmd . Name . SET_ALERT_TEXT , post ( '/session/:sessionId/alert_text' ) ] ,
192
+ [ cmd . Name . SET_ALERT_CREDENTIALS , post ( '/session/:sessionId/alert/credentials' ) ] ,
192
193
[ cmd . Name . GET_LOG , post ( '/session/:sessionId/log' ) ] ,
193
194
[ cmd . Name . GET_AVAILABLE_LOG_TYPES , get ( '/session/:sessionId/log/types' ) ] ,
194
195
[ cmd . Name . GET_SESSION_LOGS , post ( '/logs' ) ] ,
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ const Name = {
159
159
DISMISS_ALERT : 'dismissAlert' ,
160
160
GET_ALERT_TEXT : 'getAlertText' ,
161
161
SET_ALERT_TEXT : 'setAlertValue' ,
162
+ SET_ALERT_CREDENTIALS : 'setAlertCredentials' ,
162
163
163
164
EXECUTE_SQL : 'executeSQL' ,
164
165
GET_LOCATION : 'getLocation' ,
Original file line number Diff line number Diff line change @@ -2253,6 +2253,23 @@ class Alert {
2253
2253
return this . text_ ;
2254
2254
}
2255
2255
2256
+ /**
2257
+ * Sets the username and password in an alert prompting for credentials (such
2258
+ * as a Basic HTTP Auth prompt). This method will implicitly
2259
+ * {@linkplain #accept() submit} the dialog.
2260
+ *
2261
+ * @param {string } username The username to send.
2262
+ * @param {string } password The password to send.
2263
+ * @return {!promise.Promise<void> } A promise that will be resolved when this
2264
+ * command has completed.
2265
+ */
2266
+ authenticateAs ( username , password ) {
2267
+ return this . driver_ . schedule (
2268
+ new command . Command ( command . Name . SET_ALERT_CREDENTIALS ) ,
2269
+ 'WebDriver.switchTo().alert()'
2270
+ + `.authenticateAs("${ username } ", "${ password } ")` ) ;
2271
+ }
2272
+
2256
2273
/**
2257
2274
* Accepts this alert.
2258
2275
*
@@ -2347,6 +2364,16 @@ class AlertPromise extends Alert {
2347
2364
} ) ;
2348
2365
} ;
2349
2366
2367
+ /**
2368
+ * Defers action until the alert has been located.
2369
+ * @override
2370
+ */
2371
+ this . authenticateAs = function ( username , password ) {
2372
+ return alert . then ( function ( alert ) {
2373
+ return alert . authenticateAs ( username , password ) ;
2374
+ } ) ;
2375
+ } ;
2376
+
2350
2377
/**
2351
2378
* Defers action until the alert has been located.
2352
2379
* @override
You can’t perform that action at this time.
0 commit comments