MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / alertIsPresent

Function alertIsPresent

javascript/selenium-webdriver/lib/until.js:110–129  ·  view source on GitHub ↗

* Creates a condition that waits for an alert to be opened. Upon success, the * returned promise will be fulfilled with the handle for the opened alert. * * @return {!Condition<!./webdriver.Alert>} The new condition.

()

Source from the content-addressed store, hash-verified

108 * @return {!Condition<!./webdriver.Alert>} The new condition.
109 */
110function alertIsPresent() {
111 return new Condition('for alert to be present', function (driver) {
112 return driver
113 .switchTo()
114 .alert()
115 .catch(function (e) {
116 if (
117 !(
118 e instanceof error.NoSuchAlertError ||
119 // XXX: Workaround for GeckoDriver error `TypeError: can't convert null
120 // to object`. For more details, see
121 // https://github.com/SeleniumHQ/selenium/pull/2137
122 (e instanceof error.WebDriverError && e.message === `can't convert null to object`)
123 )
124 ) {
125 throw e
126 }
127 })
128 })
129}
130
131/**
132 * Creates a condition that will wait for the current page's title to match the

Callers

nothing calls this directly

Calls 2

alertMethod · 0.65
switchToMethod · 0.65

Tested by

no test coverage detected