Class webdriver.Alert
code »webdriver.promise.Promise
└ webdriver.promise.Deferred
└ webdriver.Alert
Represents a modal dialog such as alert
, confirm
, or
prompt
. Provides functions to retrieve the message displayed with
the alert, accept or dismiss the alert, and set the response text (in the
case of prompt
).
Constructor
Parameters |
---|
|
Instance Methods
Defined in webdriver.Alert
Accepts this alert.
Returns |
---|
|
Dismisses this alert.
Returns |
---|
|
Retrieves the message text displayed with this alert. For instance, if the
alert were opened with alert("hello"), then this would return "hello".
Returns |
---|
|
code »sendKeys ( text ) ⇒ !webdriver.promise.Promise
Sets the response text on this alert. This command will return an error if
the underlying alert does not support response text (e.g. window.alert and
window.confirm).
!webdriver.promise.Promise
Parameters |
---|
|
Returns |
|
Defined in webdriver.promise.Deferred
Defined in webdriver.promise.Promise
code »addBoth ( callback, opt_self ) ⇒ !webdriver.promise.Promise
Deprecated: Use #thenFinally()
instead.Registers a function to be invoked when this promise is either rejected or
resolved. This function is provided for backwards compatibility with the
Dojo Deferred API.
!webdriver.promise.Promise
#thenFinally()
instead.Parameters |
---|
Returns |
|
code »addCallback ( callback, opt_self ) ⇒ !webdriver.promise.Promise
Deprecated: Use #then()
instead.Registers a function to be invoked when this promise is successfully
resolved. This function is provided for backwards compatibility with the
Dojo Deferred API.
!webdriver.promise.Promise
#then()
instead.Parameters |
---|
Returns |
|
code »addCallbacks ( callback, errback, opt_self ) ⇒ !webdriver.promise.Promise
Deprecated: Use #then()
instead.An alias for webdriver.promise.Promise.prototype.then
that permits
the scope of the invoked function to be specified. This function is provided
for backwards compatibility with the Dojo Deferred API.
!webdriver.promise.Promise
#then()
instead.webdriver.promise.Promise.prototype.then
that permits
the scope of the invoked function to be specified. This function is provided
for backwards compatibility with the Dojo Deferred API.Parameters |
---|
|
Returns |
|
code »addErrback ( errback, opt_self ) ⇒ !webdriver.promise.Promise
Deprecated: Use #thenCatch()
instead.Registers a function to be invoked when this promise is rejected.
This function is provided for backwards compatibility with the
Dojo Deferred API.
!webdriver.promise.Promise
#thenCatch()
instead.Parameters |
---|
Returns |
|
code »then ( opt_callback, opt_errback ) ⇒ !webdriver.promise.Promise
Registers listeners for when this instance is resolved. This function most
overridden by subtypes.
!webdriver.promise.Promise
Parameters |
---|
|
Returns |
|
code »thenCatch ( errback ) ⇒ !webdriver.promise.Promise
Registers a listener for when this promise is rejected. This is synonymous
with the catch
clause in a synchronous API:
// Synchronous API:
try {
doSynchronousWork();
} catch (ex) {
console.error(ex);
}
// Asynchronous promise API:
doAsynchronousWork().thenCatch(function(ex) {
console.error(ex);
});
!webdriver.promise.Promise
catch
clause in a synchronous API:
// Synchronous API:
try {
doSynchronousWork();
} catch (ex) {
console.error(ex);
}
// Asynchronous promise API:
doAsynchronousWork().thenCatch(function(ex) {
console.error(ex);
});
Parameters |
---|
|
Returns |
|
code »thenFinally ( callback ) ⇒ !webdriver.promise.Promise
Registers a listener to invoke when this promise is resolved, regardless
of whether the promise's value was successfully computed. This function
is synonymous with the finally
clause in a synchronous API:
// Synchronous API:
try {
doSynchronousWork();
} finally {
cleanUp();
}
// Asynchronous promise API:
doAsynchronousWork().thenFinally(cleanUp);
Note: similar to the finally
clause, if the registered
callback returns a rejected promise or throws an error, it will silently
replace the rejection error (if any) from this promise:
try {
throw Error('one');
} finally {
throw Error('two'); // Hides Error: one
}
webdriver.promise.rejected(Error('one'))
.thenFinally(function() {
throw Error('two'); // Hides Error: one
});
!webdriver.promise.Promise
finally
clause in a synchronous API:
// Synchronous API:
try {
doSynchronousWork();
} finally {
cleanUp();
}
// Asynchronous promise API:
doAsynchronousWork().thenFinally(cleanUp);
try {
throw Error('one');
} finally {
throw Error('two'); // Hides Error: one
}
webdriver.promise.rejected(Error('one'))
.thenFinally(function() {
throw Error('two'); // Hides Error: one
});
Parameters |
---|
|