selenium-webdriver 4.0.0-alpha.4 → 4.0.0-alpha.8
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.
- package/.eslintrc.js +27 -0
- package/.prettierrc +4 -0
- package/CHANGES.md +22 -1
- package/README.md +4 -4
- package/chrome.js +72 -590
- package/chromium.js +1024 -0
- package/devtools/CDPConnection.js +37 -0
- package/devtools/generator/protocol-dts-generator.js +429 -0
- package/edge.js +124 -86
- package/firefox.js +201 -202
- package/http/index.js +131 -115
- package/http/util.js +56 -64
- package/ie.js +180 -104
- package/index.js +246 -199
- package/io/exec.js +34 -39
- package/io/index.js +141 -151
- package/io/zip.js +75 -65
- package/lib/README +5 -0
- package/lib/actions.js +138 -121
- package/lib/atoms/find-elements.js +123 -0
- package/lib/atoms/get-attribute.js +79 -60
- package/lib/atoms/is-displayed.js +72 -73
- package/{example/chrome_mobile_emulation.js → lib/atoms/make-atoms-module.js} +16 -23
- package/lib/by.js +192 -65
- package/lib/capabilities.js +82 -78
- package/lib/command.js +18 -20
- package/lib/error.js +134 -168
- package/lib/http.js +324 -230
- package/lib/input.js +325 -302
- package/lib/logging.js +127 -138
- package/lib/promise.js +60 -66
- package/lib/proxy.js +31 -41
- package/lib/session.js +12 -15
- package/lib/symbols.js +3 -4
- package/lib/until.js +162 -162
- package/lib/webdriver.js +733 -522
- package/net/index.js +30 -36
- package/net/portprober.js +31 -144
- package/opera.js +406 -0
- package/package.json +18 -11
- package/proxy.js +2 -2
- package/remote/index.js +190 -187
- package/safari.js +40 -49
- package/LICENSE +0 -202
- package/NOTICE +0 -2
- package/example/chrome_android.js +0 -42
- package/example/firefox_channels.js +0 -77
- package/example/google_search.js +0 -50
- package/example/google_search_test.js +0 -72
- package/example/headless.js +0 -55
- package/example/logging.js +0 -68
- package/testing/index.js +0 -498
package/lib/until.js
CHANGED
|
@@ -39,15 +39,13 @@
|
|
|
39
39
|
* }, 1000);
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
'use strict'
|
|
42
|
+
'use strict'
|
|
43
43
|
|
|
44
|
-
const by = require('./by')
|
|
45
|
-
const
|
|
46
|
-
const error = require('./error');
|
|
44
|
+
const by = require('./by')
|
|
45
|
+
const error = require('./error')
|
|
47
46
|
const webdriver = require('./webdriver'),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Condition = webdriver.Condition,
|
|
48
|
+
WebElementCondition = webdriver.WebElementCondition
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* Creates a condition that will wait until the input driver is able to switch
|
|
@@ -70,33 +68,38 @@ const webdriver = require('./webdriver'),
|
|
|
70
68
|
* @return {!Condition<boolean>} A new condition.
|
|
71
69
|
*/
|
|
72
70
|
exports.ableToSwitchToFrame = function ableToSwitchToFrame(frame) {
|
|
73
|
-
var condition
|
|
71
|
+
var condition
|
|
74
72
|
if (typeof frame === 'number' || frame instanceof webdriver.WebElement) {
|
|
75
|
-
condition = driver => attemptToSwitchFrames(driver, frame)
|
|
73
|
+
condition = (driver) => attemptToSwitchFrames(driver, frame)
|
|
76
74
|
} else {
|
|
77
|
-
condition = function(driver) {
|
|
78
|
-
let locator = /** @type {!(By|Function)} */(frame)
|
|
79
|
-
return driver.findElements(locator).then(function(els) {
|
|
75
|
+
condition = function (driver) {
|
|
76
|
+
let locator = /** @type {!(By|Function)} */ (frame)
|
|
77
|
+
return driver.findElements(locator).then(function (els) {
|
|
80
78
|
if (els.length) {
|
|
81
|
-
return attemptToSwitchFrames(driver, els[0])
|
|
79
|
+
return attemptToSwitchFrames(driver, els[0])
|
|
82
80
|
}
|
|
83
|
-
})
|
|
84
|
-
}
|
|
81
|
+
})
|
|
82
|
+
}
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
return new Condition('to be able to switch to frame', condition)
|
|
85
|
+
return new Condition('to be able to switch to frame', condition)
|
|
88
86
|
|
|
89
87
|
function attemptToSwitchFrames(driver, frame) {
|
|
90
|
-
return driver
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
return driver
|
|
89
|
+
.switchTo()
|
|
90
|
+
.frame(frame)
|
|
91
|
+
.then(
|
|
92
|
+
function () {
|
|
93
|
+
return true
|
|
94
|
+
},
|
|
95
|
+
function (e) {
|
|
93
96
|
if (!(e instanceof error.NoSuchFrameError)) {
|
|
94
|
-
throw e
|
|
97
|
+
throw e
|
|
95
98
|
}
|
|
96
|
-
}
|
|
99
|
+
}
|
|
100
|
+
)
|
|
97
101
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
102
|
+
}
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
105
|
* Creates a condition that waits for an alert to be opened. Upon success, the
|
|
@@ -105,21 +108,26 @@ exports.ableToSwitchToFrame = function ableToSwitchToFrame(frame) {
|
|
|
105
108
|
* @return {!Condition<!./webdriver.Alert>} The new condition.
|
|
106
109
|
*/
|
|
107
110
|
exports.alertIsPresent = function alertIsPresent() {
|
|
108
|
-
return new Condition('for alert to be present', function(driver) {
|
|
109
|
-
return driver
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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 &&
|
|
123
|
+
e.message === `can't convert null to object`)
|
|
124
|
+
)
|
|
125
|
+
) {
|
|
126
|
+
throw e
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}
|
|
123
131
|
|
|
124
132
|
/**
|
|
125
133
|
* Creates a condition that will wait for the current page's title to match the
|
|
@@ -129,15 +137,14 @@ exports.alertIsPresent = function alertIsPresent() {
|
|
|
129
137
|
* @return {!Condition<boolean>} The new condition.
|
|
130
138
|
*/
|
|
131
139
|
exports.titleIs = function titleIs(title) {
|
|
132
|
-
return new Condition(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
140
|
+
return new Condition('for title to be ' + JSON.stringify(title), function (
|
|
141
|
+
driver
|
|
142
|
+
) {
|
|
143
|
+
return driver.getTitle().then(function (t) {
|
|
144
|
+
return t === title
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}
|
|
141
148
|
|
|
142
149
|
/**
|
|
143
150
|
* Creates a condition that will wait for the current page's title to contain
|
|
@@ -149,14 +156,14 @@ exports.titleIs = function titleIs(title) {
|
|
|
149
156
|
*/
|
|
150
157
|
exports.titleContains = function titleContains(substr) {
|
|
151
158
|
return new Condition(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
'for title to contain ' + JSON.stringify(substr),
|
|
160
|
+
function (driver) {
|
|
161
|
+
return driver.getTitle().then(function (title) {
|
|
162
|
+
return title.indexOf(substr) !== -1
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
160
167
|
|
|
161
168
|
/**
|
|
162
169
|
* Creates a condition that will wait for the current page's title to match the
|
|
@@ -166,13 +173,12 @@ exports.titleContains = function titleContains(substr) {
|
|
|
166
173
|
* @return {!Condition<boolean>} The new condition.
|
|
167
174
|
*/
|
|
168
175
|
exports.titleMatches = function titleMatches(regex) {
|
|
169
|
-
return new Condition('for title to match ' + regex, function(driver) {
|
|
170
|
-
return driver.getTitle().then(function(title) {
|
|
171
|
-
return regex.test(title)
|
|
172
|
-
})
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
+
return new Condition('for title to match ' + regex, function (driver) {
|
|
177
|
+
return driver.getTitle().then(function (title) {
|
|
178
|
+
return regex.test(title)
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
}
|
|
176
182
|
|
|
177
183
|
/**
|
|
178
184
|
* Creates a condition that will wait for the current page's url to match the
|
|
@@ -182,15 +188,14 @@ exports.titleMatches = function titleMatches(regex) {
|
|
|
182
188
|
* @return {!Condition<boolean>} The new condition.
|
|
183
189
|
*/
|
|
184
190
|
exports.urlIs = function urlIs(url) {
|
|
185
|
-
return new Condition(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
191
|
+
return new Condition('for URL to be ' + JSON.stringify(url), function (
|
|
192
|
+
driver
|
|
193
|
+
) {
|
|
194
|
+
return driver.getCurrentUrl().then(function (u) {
|
|
195
|
+
return u === url
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
}
|
|
194
199
|
|
|
195
200
|
/**
|
|
196
201
|
* Creates a condition that will wait for the current page's url to contain
|
|
@@ -202,14 +207,14 @@ exports.urlIs = function urlIs(url) {
|
|
|
202
207
|
*/
|
|
203
208
|
exports.urlContains = function urlContains(substrUrl) {
|
|
204
209
|
return new Condition(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
'for URL to contain ' + JSON.stringify(substrUrl),
|
|
211
|
+
function (driver) {
|
|
212
|
+
return driver.getCurrentUrl().then(function (url) {
|
|
213
|
+
return url && url.indexOf(substrUrl) !== -1
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
}
|
|
213
218
|
|
|
214
219
|
/**
|
|
215
220
|
* Creates a condition that will wait for the current page's url to match the
|
|
@@ -219,13 +224,12 @@ exports.urlContains = function urlContains(substrUrl) {
|
|
|
219
224
|
* @return {!Condition<boolean>} The new condition.
|
|
220
225
|
*/
|
|
221
226
|
exports.urlMatches = function urlMatches(regex) {
|
|
222
|
-
return new Condition('for URL to match ' + regex, function(driver) {
|
|
223
|
-
return driver.getCurrentUrl().then(function(url) {
|
|
224
|
-
return regex.test(url)
|
|
225
|
-
})
|
|
226
|
-
})
|
|
227
|
-
}
|
|
228
|
-
|
|
227
|
+
return new Condition('for URL to match ' + regex, function (driver) {
|
|
228
|
+
return driver.getCurrentUrl().then(function (url) {
|
|
229
|
+
return regex.test(url)
|
|
230
|
+
})
|
|
231
|
+
})
|
|
232
|
+
}
|
|
229
233
|
|
|
230
234
|
/**
|
|
231
235
|
* Creates a condition that will loop until an element is
|
|
@@ -235,17 +239,18 @@ exports.urlMatches = function urlMatches(regex) {
|
|
|
235
239
|
* @return {!WebElementCondition} The new condition.
|
|
236
240
|
*/
|
|
237
241
|
exports.elementLocated = function elementLocated(locator) {
|
|
238
|
-
locator = by.checkedLocator(locator)
|
|
242
|
+
locator = by.checkedLocator(locator)
|
|
239
243
|
let locatorStr =
|
|
240
|
-
|
|
241
|
-
return new WebElementCondition(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
})
|
|
247
|
-
}
|
|
248
|
-
|
|
244
|
+
typeof locator === 'function' ? 'by function()' : locator + ''
|
|
245
|
+
return new WebElementCondition(
|
|
246
|
+
'for element to be located ' + locatorStr,
|
|
247
|
+
function (driver) {
|
|
248
|
+
return driver.findElements(locator).then(function (elements) {
|
|
249
|
+
return elements[0]
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
}
|
|
249
254
|
|
|
250
255
|
/**
|
|
251
256
|
* Creates a condition that will loop until at least one element is
|
|
@@ -256,18 +261,18 @@ exports.elementLocated = function elementLocated(locator) {
|
|
|
256
261
|
* condition.
|
|
257
262
|
*/
|
|
258
263
|
exports.elementsLocated = function elementsLocated(locator) {
|
|
259
|
-
locator = by.checkedLocator(locator)
|
|
264
|
+
locator = by.checkedLocator(locator)
|
|
260
265
|
let locatorStr =
|
|
261
|
-
|
|
266
|
+
typeof locator === 'function' ? 'by function()' : locator + ''
|
|
262
267
|
return new Condition(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
'for at least one element to be located ' + locatorStr,
|
|
269
|
+
function (driver) {
|
|
270
|
+
return driver.findElements(locator).then(function (elements) {
|
|
271
|
+
return elements.length > 0 ? elements : null
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
}
|
|
271
276
|
|
|
272
277
|
/**
|
|
273
278
|
* Creates a condition that will wait for the given element to become stale. An
|
|
@@ -278,18 +283,20 @@ exports.elementsLocated = function elementsLocated(locator) {
|
|
|
278
283
|
* @return {!Condition<boolean>} The new condition.
|
|
279
284
|
*/
|
|
280
285
|
exports.stalenessOf = function stalenessOf(element) {
|
|
281
|
-
return new Condition('element to become stale', function() {
|
|
286
|
+
return new Condition('element to become stale', function () {
|
|
282
287
|
return element.getTagName().then(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
288
|
+
function () {
|
|
289
|
+
return false
|
|
290
|
+
},
|
|
291
|
+
function (e) {
|
|
292
|
+
if (e instanceof error.StaleElementReferenceError) {
|
|
293
|
+
return true
|
|
294
|
+
}
|
|
295
|
+
throw e
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
})
|
|
299
|
+
}
|
|
293
300
|
|
|
294
301
|
/**
|
|
295
302
|
* Creates a condition that will wait for the given element to become visible.
|
|
@@ -299,11 +306,10 @@ exports.stalenessOf = function stalenessOf(element) {
|
|
|
299
306
|
* @see ./webdriver.WebDriver#isDisplayed
|
|
300
307
|
*/
|
|
301
308
|
exports.elementIsVisible = function elementIsVisible(element) {
|
|
302
|
-
return new WebElementCondition('until element is visible', function() {
|
|
303
|
-
return element.isDisplayed().then(v => v ? element : null)
|
|
304
|
-
})
|
|
305
|
-
}
|
|
306
|
-
|
|
309
|
+
return new WebElementCondition('until element is visible', function () {
|
|
310
|
+
return element.isDisplayed().then((v) => (v ? element : null))
|
|
311
|
+
})
|
|
312
|
+
}
|
|
307
313
|
|
|
308
314
|
/**
|
|
309
315
|
* Creates a condition that will wait for the given element to be in the DOM,
|
|
@@ -314,11 +320,10 @@ exports.elementIsVisible = function elementIsVisible(element) {
|
|
|
314
320
|
* @see ./webdriver.WebDriver#isDisplayed
|
|
315
321
|
*/
|
|
316
322
|
exports.elementIsNotVisible = function elementIsNotVisible(element) {
|
|
317
|
-
return new WebElementCondition('until element is not visible', function() {
|
|
318
|
-
return element.isDisplayed().then(v => v ? null : element)
|
|
319
|
-
})
|
|
320
|
-
}
|
|
321
|
-
|
|
323
|
+
return new WebElementCondition('until element is not visible', function () {
|
|
324
|
+
return element.isDisplayed().then((v) => (v ? null : element))
|
|
325
|
+
})
|
|
326
|
+
}
|
|
322
327
|
|
|
323
328
|
/**
|
|
324
329
|
* Creates a condition that will wait for the given element to be enabled.
|
|
@@ -328,11 +333,10 @@ exports.elementIsNotVisible = function elementIsNotVisible(element) {
|
|
|
328
333
|
* @see webdriver.WebDriver#isEnabled
|
|
329
334
|
*/
|
|
330
335
|
exports.elementIsEnabled = function elementIsEnabled(element) {
|
|
331
|
-
return new WebElementCondition('until element is enabled', function() {
|
|
332
|
-
return element.isEnabled().then(v => v ? element : null)
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
+
return new WebElementCondition('until element is enabled', function () {
|
|
337
|
+
return element.isEnabled().then((v) => (v ? element : null))
|
|
338
|
+
})
|
|
339
|
+
}
|
|
336
340
|
|
|
337
341
|
/**
|
|
338
342
|
* Creates a condition that will wait for the given element to be disabled.
|
|
@@ -342,11 +346,10 @@ exports.elementIsEnabled = function elementIsEnabled(element) {
|
|
|
342
346
|
* @see webdriver.WebDriver#isEnabled
|
|
343
347
|
*/
|
|
344
348
|
exports.elementIsDisabled = function elementIsDisabled(element) {
|
|
345
|
-
return new WebElementCondition('until element is disabled', function() {
|
|
346
|
-
return element.isEnabled().then(v => v ? null : element)
|
|
347
|
-
})
|
|
348
|
-
}
|
|
349
|
-
|
|
349
|
+
return new WebElementCondition('until element is disabled', function () {
|
|
350
|
+
return element.isEnabled().then((v) => (v ? null : element))
|
|
351
|
+
})
|
|
352
|
+
}
|
|
350
353
|
|
|
351
354
|
/**
|
|
352
355
|
* Creates a condition that will wait for the given element to be selected.
|
|
@@ -355,11 +358,10 @@ exports.elementIsDisabled = function elementIsDisabled(element) {
|
|
|
355
358
|
* @see webdriver.WebDriver#isSelected
|
|
356
359
|
*/
|
|
357
360
|
exports.elementIsSelected = function elementIsSelected(element) {
|
|
358
|
-
return new WebElementCondition('until element is selected', function() {
|
|
359
|
-
return element.isSelected().then(v => v ? element : null)
|
|
360
|
-
})
|
|
361
|
-
}
|
|
362
|
-
|
|
361
|
+
return new WebElementCondition('until element is selected', function () {
|
|
362
|
+
return element.isSelected().then((v) => (v ? element : null))
|
|
363
|
+
})
|
|
364
|
+
}
|
|
363
365
|
|
|
364
366
|
/**
|
|
365
367
|
* Creates a condition that will wait for the given element to be deselected.
|
|
@@ -369,11 +371,10 @@ exports.elementIsSelected = function elementIsSelected(element) {
|
|
|
369
371
|
* @see webdriver.WebDriver#isSelected
|
|
370
372
|
*/
|
|
371
373
|
exports.elementIsNotSelected = function elementIsNotSelected(element) {
|
|
372
|
-
return new WebElementCondition('until element is not selected', function() {
|
|
373
|
-
return element.isSelected().then(v => v ? null : element)
|
|
374
|
-
})
|
|
375
|
-
}
|
|
376
|
-
|
|
374
|
+
return new WebElementCondition('until element is not selected', function () {
|
|
375
|
+
return element.isSelected().then((v) => (v ? null : element))
|
|
376
|
+
})
|
|
377
|
+
}
|
|
377
378
|
|
|
378
379
|
/**
|
|
379
380
|
* Creates a condition that will wait for the given element's
|
|
@@ -386,11 +387,10 @@ exports.elementIsNotSelected = function elementIsNotSelected(element) {
|
|
|
386
387
|
* @see webdriver.WebDriver#getText
|
|
387
388
|
*/
|
|
388
389
|
exports.elementTextIs = function elementTextIs(element, text) {
|
|
389
|
-
return new WebElementCondition('until element text is', function() {
|
|
390
|
-
return element.getText().then(t => t === text ? element : null)
|
|
391
|
-
})
|
|
392
|
-
}
|
|
393
|
-
|
|
390
|
+
return new WebElementCondition('until element text is', function () {
|
|
391
|
+
return element.getText().then((t) => (t === text ? element : null))
|
|
392
|
+
})
|
|
393
|
+
}
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
396
|
* Creates a condition that will wait for the given element's
|
|
@@ -403,12 +403,12 @@ exports.elementTextIs = function elementTextIs(element, text) {
|
|
|
403
403
|
* @see webdriver.WebDriver#getText
|
|
404
404
|
*/
|
|
405
405
|
exports.elementTextContains = function elementTextContains(element, substr) {
|
|
406
|
-
return new WebElementCondition('until element text contains', function() {
|
|
407
|
-
return element
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
|
|
406
|
+
return new WebElementCondition('until element text contains', function () {
|
|
407
|
+
return element
|
|
408
|
+
.getText()
|
|
409
|
+
.then((t) => (t.indexOf(substr) != -1 ? element : null))
|
|
410
|
+
})
|
|
411
|
+
}
|
|
412
412
|
|
|
413
413
|
/**
|
|
414
414
|
* Creates a condition that will wait for the given element's
|
|
@@ -421,7 +421,7 @@ exports.elementTextContains = function elementTextContains(element, substr) {
|
|
|
421
421
|
* @see webdriver.WebDriver#getText
|
|
422
422
|
*/
|
|
423
423
|
exports.elementTextMatches = function elementTextMatches(element, regex) {
|
|
424
|
-
return new WebElementCondition('until element text matches', function() {
|
|
425
|
-
return element.getText().then(t => regex.test(t) ? element : null)
|
|
426
|
-
})
|
|
427
|
-
}
|
|
424
|
+
return new WebElementCondition('until element text matches', function () {
|
|
425
|
+
return element.getText().then((t) => (regex.test(t) ? element : null))
|
|
426
|
+
})
|
|
427
|
+
}
|