selenium-webdriver 4.17.0 → 4.18.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.
- package/CHANGES.md +240 -196
- package/bidi/addInterceptParameters.js +86 -0
- package/bidi/browsingContext.js +144 -37
- package/bidi/browsingContextInspector.js +13 -40
- package/bidi/evaluateResult.js +4 -10
- package/bidi/filterBy.js +2 -6
- package/bidi/index.js +31 -29
- package/bidi/input.js +1 -4
- package/bidi/interceptPhase.js +24 -0
- package/bidi/logInspector.js +15 -20
- package/bidi/network.js +178 -0
- package/bidi/networkInspector.js +8 -2
- package/bidi/networkTypes.js +22 -49
- package/bidi/protocolType.js +3 -9
- package/bidi/protocolValue.js +6 -25
- package/bidi/realmInfo.js +2 -10
- package/bidi/scriptManager.js +20 -59
- package/bidi/urlPattern.js +58 -0
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/chrome.js +1 -8
- package/chromium.js +27 -109
- package/common/driverFinder.js +1 -1
- package/common/seleniumManager.js +9 -18
- package/devtools/CDPConnection.js +1 -3
- package/edge.js +1 -3
- package/example/chrome_android.js +2 -5
- package/example/chrome_mobile_emulation.js +2 -4
- package/example/google_search.js +1 -3
- package/example/headless.js +4 -10
- package/example/logging.js +3 -9
- package/firefox.js +55 -109
- package/http/index.js +7 -10
- package/ie.js +5 -15
- package/index.js +7 -29
- package/io/exec.js +1 -2
- package/io/index.js +3 -3
- package/io/zip.js +8 -30
- package/lib/by.js +2 -9
- package/lib/capabilities.js +3 -9
- package/lib/command.js +3 -3
- package/lib/error.js +2 -9
- package/lib/http.js +34 -131
- package/lib/input.js +10 -34
- package/lib/logging.js +3 -11
- package/lib/promise.js +2 -7
- package/lib/select.js +3 -9
- package/lib/until.js +28 -49
- package/lib/util.js +1 -4
- package/lib/virtual_authenticator.js +4 -22
- package/lib/webdriver.js +118 -297
- package/lib/webelement.js +1 -5
- package/net/index.js +1 -4
- package/package.json +2 -1
- package/remote/index.js +9 -24
- package/remote/util.js +6 -19
- package/safari.js +3 -8
- package/testing/index.js +6 -11
package/lib/until.js
CHANGED
|
@@ -96,7 +96,7 @@ function ableToSwitchToFrame(frame) {
|
|
|
96
96
|
if (!(e instanceof error.NoSuchFrameError)) {
|
|
97
97
|
throw e
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
100
|
)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -119,8 +119,7 @@ function alertIsPresent() {
|
|
|
119
119
|
// XXX: Workaround for GeckoDriver error `TypeError: can't convert null
|
|
120
120
|
// to object`. For more details, see
|
|
121
121
|
// https://github.com/SeleniumHQ/selenium/pull/2137
|
|
122
|
-
(e instanceof error.WebDriverError &&
|
|
123
|
-
e.message === `can't convert null to object`)
|
|
122
|
+
(e instanceof error.WebDriverError && e.message === `can't convert null to object`)
|
|
124
123
|
)
|
|
125
124
|
) {
|
|
126
125
|
throw e
|
|
@@ -137,9 +136,7 @@ function alertIsPresent() {
|
|
|
137
136
|
* @return {!Condition<boolean>} The new condition.
|
|
138
137
|
*/
|
|
139
138
|
function titleIs(title) {
|
|
140
|
-
return new Condition('for title to be ' + JSON.stringify(title), function (
|
|
141
|
-
driver
|
|
142
|
-
) {
|
|
139
|
+
return new Condition('for title to be ' + JSON.stringify(title), function (driver) {
|
|
143
140
|
return driver.getTitle().then(function (t) {
|
|
144
141
|
return t === title
|
|
145
142
|
})
|
|
@@ -155,14 +152,11 @@ function titleIs(title) {
|
|
|
155
152
|
* @return {!Condition<boolean>} The new condition.
|
|
156
153
|
*/
|
|
157
154
|
function titleContains(substr) {
|
|
158
|
-
return new Condition(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
)
|
|
155
|
+
return new Condition('for title to contain ' + JSON.stringify(substr), function (driver) {
|
|
156
|
+
return driver.getTitle().then(function (title) {
|
|
157
|
+
return title.indexOf(substr) !== -1
|
|
158
|
+
})
|
|
159
|
+
})
|
|
166
160
|
}
|
|
167
161
|
|
|
168
162
|
/**
|
|
@@ -188,9 +182,7 @@ function titleMatches(regex) {
|
|
|
188
182
|
* @return {!Condition<boolean>} The new condition.
|
|
189
183
|
*/
|
|
190
184
|
function urlIs(url) {
|
|
191
|
-
return new Condition('for URL to be ' + JSON.stringify(url), function (
|
|
192
|
-
driver
|
|
193
|
-
) {
|
|
185
|
+
return new Condition('for URL to be ' + JSON.stringify(url), function (driver) {
|
|
194
186
|
return driver.getCurrentUrl().then(function (u) {
|
|
195
187
|
return u === url
|
|
196
188
|
})
|
|
@@ -206,14 +198,11 @@ function urlIs(url) {
|
|
|
206
198
|
* @return {!Condition<boolean>} The new condition.
|
|
207
199
|
*/
|
|
208
200
|
function urlContains(substrUrl) {
|
|
209
|
-
return new Condition(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
)
|
|
201
|
+
return new Condition('for URL to contain ' + JSON.stringify(substrUrl), function (driver) {
|
|
202
|
+
return driver.getCurrentUrl().then(function (url) {
|
|
203
|
+
return url && url.includes(substrUrl)
|
|
204
|
+
})
|
|
205
|
+
})
|
|
217
206
|
}
|
|
218
207
|
|
|
219
208
|
/**
|
|
@@ -240,16 +229,12 @@ function urlMatches(regex) {
|
|
|
240
229
|
*/
|
|
241
230
|
function elementLocated(locator) {
|
|
242
231
|
locator = by.checkedLocator(locator)
|
|
243
|
-
let locatorStr =
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return elements[0]
|
|
250
|
-
})
|
|
251
|
-
}
|
|
252
|
-
)
|
|
232
|
+
let locatorStr = typeof locator === 'function' ? 'by function()' : locator + ''
|
|
233
|
+
return new WebElementCondition('for element to be located ' + locatorStr, function (driver) {
|
|
234
|
+
return driver.findElements(locator).then(function (elements) {
|
|
235
|
+
return elements[0]
|
|
236
|
+
})
|
|
237
|
+
})
|
|
253
238
|
}
|
|
254
239
|
|
|
255
240
|
/**
|
|
@@ -262,16 +247,12 @@ function elementLocated(locator) {
|
|
|
262
247
|
*/
|
|
263
248
|
function elementsLocated(locator) {
|
|
264
249
|
locator = by.checkedLocator(locator)
|
|
265
|
-
let locatorStr =
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return elements.length > 0 ? elements : null
|
|
272
|
-
})
|
|
273
|
-
}
|
|
274
|
-
)
|
|
250
|
+
let locatorStr = typeof locator === 'function' ? 'by function()' : locator + ''
|
|
251
|
+
return new Condition('for at least one element to be located ' + locatorStr, function (driver) {
|
|
252
|
+
return driver.findElements(locator).then(function (elements) {
|
|
253
|
+
return elements.length > 0 ? elements : null
|
|
254
|
+
})
|
|
255
|
+
})
|
|
275
256
|
}
|
|
276
257
|
|
|
277
258
|
/**
|
|
@@ -293,7 +274,7 @@ function stalenessOf(element) {
|
|
|
293
274
|
return true
|
|
294
275
|
}
|
|
295
276
|
throw e
|
|
296
|
-
}
|
|
277
|
+
},
|
|
297
278
|
)
|
|
298
279
|
})
|
|
299
280
|
}
|
|
@@ -404,9 +385,7 @@ function elementTextIs(element, text) {
|
|
|
404
385
|
*/
|
|
405
386
|
function elementTextContains(element, substr) {
|
|
406
387
|
return new WebElementCondition('until element text contains', function () {
|
|
407
|
-
return element
|
|
408
|
-
.getText()
|
|
409
|
-
.then((t) => (t.indexOf(substr) != -1 ? element : null))
|
|
388
|
+
return element.getText().then((t) => (t.indexOf(substr) != -1 ? element : null))
|
|
410
389
|
})
|
|
411
390
|
}
|
|
412
391
|
|
package/lib/util.js
CHANGED
|
@@ -37,10 +37,7 @@ function isPromise(value) {
|
|
|
37
37
|
try {
|
|
38
38
|
// Use array notation so the Closure compiler does not obfuscate away our
|
|
39
39
|
// contract.
|
|
40
|
-
return (
|
|
41
|
-
(typeof value === 'object' || typeof value === 'function') &&
|
|
42
|
-
typeof value['then'] === 'function'
|
|
43
|
-
)
|
|
40
|
+
return (typeof value === 'object' || typeof value === 'function') && typeof value['then'] === 'function'
|
|
44
41
|
} catch (ex) {
|
|
45
42
|
return false
|
|
46
43
|
}
|
|
@@ -119,14 +119,7 @@ class VirtualAuthenticatorOptions {
|
|
|
119
119
|
* @see https://w3c.github.io/webauthn/#credential-parameters
|
|
120
120
|
*/
|
|
121
121
|
class Credential {
|
|
122
|
-
constructor(
|
|
123
|
-
credentialId,
|
|
124
|
-
isResidentCredential,
|
|
125
|
-
rpId,
|
|
126
|
-
userHandle,
|
|
127
|
-
privateKey,
|
|
128
|
-
signCount
|
|
129
|
-
) {
|
|
122
|
+
constructor(credentialId, isResidentCredential, rpId, userHandle, privateKey, signCount) {
|
|
130
123
|
this._id = credentialId
|
|
131
124
|
this._isResidentCredential = isResidentCredential
|
|
132
125
|
this._rpId = rpId
|
|
@@ -207,9 +200,7 @@ class Credential {
|
|
|
207
200
|
}
|
|
208
201
|
|
|
209
202
|
if (this.userHandle() != null) {
|
|
210
|
-
credentialData['userHandle'] = Buffer.from(this._userHandle).toString(
|
|
211
|
-
'base64url'
|
|
212
|
-
)
|
|
203
|
+
credentialData['userHandle'] = Buffer.from(this._userHandle).toString('base64url')
|
|
213
204
|
}
|
|
214
205
|
|
|
215
206
|
return credentialData
|
|
@@ -222,9 +213,7 @@ class Credential {
|
|
|
222
213
|
let id = new Uint8Array(Buffer.from(data['credentialId'], 'base64url'))
|
|
223
214
|
let isResidentCredential = data['isResidentCredential']
|
|
224
215
|
let rpId = data['rpId']
|
|
225
|
-
let privateKey = Buffer.from(data['privateKey'], 'base64url').toString(
|
|
226
|
-
'binary'
|
|
227
|
-
)
|
|
216
|
+
let privateKey = Buffer.from(data['privateKey'], 'base64url').toString('binary')
|
|
228
217
|
let signCount = data['signCount']
|
|
229
218
|
let userHandle
|
|
230
219
|
|
|
@@ -233,14 +222,7 @@ class Credential {
|
|
|
233
222
|
} else {
|
|
234
223
|
userHandle = null
|
|
235
224
|
}
|
|
236
|
-
return new Credential(
|
|
237
|
-
id,
|
|
238
|
-
isResidentCredential,
|
|
239
|
-
rpId,
|
|
240
|
-
userHandle,
|
|
241
|
-
privateKey,
|
|
242
|
-
signCount
|
|
243
|
-
)
|
|
225
|
+
return new Credential(id, isResidentCredential, rpId, userHandle, privateKey, signCount)
|
|
244
226
|
}
|
|
245
227
|
}
|
|
246
228
|
|