selenium-webdriver 4.18.1 → 4.20.0
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 +946 -743
- package/README.md +71 -72
- package/bidi/addInterceptParameters.js +65 -45
- package/bidi/argumentValue.js +1 -0
- package/bidi/browser.js +94 -0
- package/bidi/browsingContext.js +214 -32
- package/bidi/browsingContextInspector.js +51 -0
- package/bidi/browsingContextTypes.js +31 -0
- package/bidi/captureScreenshotParameters.js +96 -0
- package/bidi/clipRectangle.js +127 -0
- package/bidi/continueRequestParameters.js +122 -0
- package/bidi/continueResponseParameters.js +129 -0
- package/bidi/cookieFilter.js +139 -0
- package/bidi/createContextParameters.js +73 -0
- package/bidi/evaluateResult.js +17 -0
- package/bidi/index.js +25 -26
- package/bidi/input.js +47 -3
- package/bidi/interceptPhase.js +5 -1
- package/bidi/logEntries.js +66 -0
- package/bidi/network.js +176 -23
- package/bidi/networkTypes.js +394 -17
- package/bidi/partialCookie.js +115 -0
- package/bidi/partitionDescriptor.js +102 -0
- package/bidi/partitionKey.js +53 -0
- package/bidi/protocolType.js +20 -0
- package/bidi/protocolValue.js +140 -9
- package/bidi/provideResponseParameters.js +123 -0
- package/bidi/realmInfo.js +27 -0
- package/bidi/resultOwnership.js +4 -0
- package/bidi/scriptManager.js +131 -5
- package/bidi/scriptTypes.js +36 -0
- package/bidi/storage.js +201 -0
- package/bidi/urlPattern.js +36 -3
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/chromium.js +13 -9
- package/common/driverFinder.js +36 -4
- package/common/seleniumManager.js +7 -39
- package/devtools/CDPConnection.js +1 -0
- package/devtools/networkinterceptor.js +1 -0
- package/eslint.config.js +107 -0
- package/firefox.js +20 -6
- package/http/index.js +6 -6
- package/http/util.js +1 -0
- package/ie.js +8 -4
- package/index.js +11 -0
- package/io/exec.js +1 -1
- package/io/index.js +3 -2
- package/io/zip.js +1 -1
- package/lib/atoms/find-elements.js +26 -26
- package/lib/atoms/is-displayed.js +24 -97
- package/lib/capabilities.js +5 -5
- package/lib/http.js +8 -4
- package/lib/input.js +0 -1
- package/lib/pinnedScript.js +1 -1
- package/lib/select.js +8 -8
- package/lib/until.js +3 -3
- package/lib/util.js +1 -0
- package/lib/virtual_authenticator.js +8 -8
- package/lib/webdriver.js +8 -3
- package/net/index.js +1 -1
- package/net/portprober.js +1 -1
- package/package.json +21 -13
- package/remote/index.js +1 -1
- package/remote/util.js +2 -2
- package/safari.js +3 -3
- package/testing/index.js +17 -8
package/bidi/networkTypes.js
CHANGED
|
@@ -17,31 +17,118 @@
|
|
|
17
17
|
|
|
18
18
|
const { NavigationInfo } = require('./browsingContextTypes')
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Represents the possible values for the SameSite attribute of a cookie.
|
|
22
|
+
* @enum {string}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const SameSite = {
|
|
26
|
+
STRICT: 'strict',
|
|
27
|
+
LAX: 'lax',
|
|
28
|
+
NONE: 'none',
|
|
29
|
+
|
|
30
|
+
findByName(name) {
|
|
31
|
+
return (
|
|
32
|
+
Object.values(this).find((type) => {
|
|
33
|
+
return typeof type === 'string' && name.toLowerCase() === type.toLowerCase()
|
|
34
|
+
}) || null
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents a BytesValue object.
|
|
41
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-BytesValue.
|
|
42
|
+
*/
|
|
43
|
+
class BytesValue {
|
|
44
|
+
static Type = {
|
|
45
|
+
STRING: 'string',
|
|
46
|
+
BASE64: 'base64',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new BytesValue instance.
|
|
51
|
+
* @param {string} type - The type of the BytesValue.
|
|
52
|
+
* @param {string} value - The value of the BytesValue.
|
|
53
|
+
*/
|
|
54
|
+
constructor(type, value) {
|
|
55
|
+
this._type = type
|
|
56
|
+
this._value = value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the type of the BytesValue.
|
|
61
|
+
* @returns {string} The type of the BytesValue.
|
|
62
|
+
*/
|
|
63
|
+
get type() {
|
|
64
|
+
return this._type
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Gets the value of the BytesValue.
|
|
69
|
+
* @returns {string} The value of the BytesValue.
|
|
70
|
+
*/
|
|
71
|
+
get value() {
|
|
72
|
+
return this._value
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Converts the BytesValue to a map.
|
|
77
|
+
* @returns {Map<string, string>} A map representation of the BytesValue.
|
|
78
|
+
*/
|
|
79
|
+
asMap() {
|
|
80
|
+
const map = new Map()
|
|
81
|
+
map.set('type', this._type)
|
|
82
|
+
map.set('value', this._value)
|
|
83
|
+
return map
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Represents a header with a name and value.
|
|
89
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-Header.
|
|
90
|
+
*/
|
|
20
91
|
class Header {
|
|
21
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new Header instance.
|
|
94
|
+
* @param {string} name - The name of the header.
|
|
95
|
+
* @param {BytesValue} value - The value of the header.
|
|
96
|
+
* @throws {Error} If the value is not an instance of BytesValue.
|
|
97
|
+
*/
|
|
98
|
+
constructor(name, value) {
|
|
22
99
|
this._name = name
|
|
100
|
+
if (!(value instanceof BytesValue)) {
|
|
101
|
+
throw new Error(`Value must be an instance of BytesValue. Received: '${value}'`)
|
|
102
|
+
}
|
|
23
103
|
this._value = value
|
|
24
|
-
this._binaryValue = binaryValue
|
|
25
104
|
}
|
|
26
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Gets the name of the header.
|
|
108
|
+
* @returns {string} The name of the header.
|
|
109
|
+
*/
|
|
27
110
|
get name() {
|
|
28
111
|
return this._name
|
|
29
112
|
}
|
|
30
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Gets the value of the header.
|
|
116
|
+
* @returns {BytesValue} The value of the header.
|
|
117
|
+
*/
|
|
31
118
|
get value() {
|
|
32
119
|
return this._value
|
|
33
120
|
}
|
|
34
|
-
|
|
35
|
-
get binaryValue() {
|
|
36
|
-
return this._binaryValue
|
|
37
|
-
}
|
|
38
121
|
}
|
|
39
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Represents a cookie.
|
|
125
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-Cookie.
|
|
126
|
+
* @class
|
|
127
|
+
*/
|
|
40
128
|
class Cookie {
|
|
41
|
-
constructor(name, value,
|
|
129
|
+
constructor(name, value, domain, path, size, httpOnly, secure, sameSite, expires) {
|
|
42
130
|
this._name = name
|
|
43
131
|
this._value = value
|
|
44
|
-
this._binaryValue = binaryValue
|
|
45
132
|
this._domain = domain
|
|
46
133
|
this._path = path
|
|
47
134
|
this._expires = expires
|
|
@@ -51,48 +138,85 @@ class Cookie {
|
|
|
51
138
|
this._sameSite = sameSite
|
|
52
139
|
}
|
|
53
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Gets the name of the cookie.
|
|
143
|
+
* @returns {string} The name of the cookie.
|
|
144
|
+
*/
|
|
54
145
|
get name() {
|
|
55
146
|
return this._name
|
|
56
147
|
}
|
|
57
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Gets the value of the cookie.
|
|
151
|
+
* @returns {BytesValue} The value of the cookie.
|
|
152
|
+
*/
|
|
58
153
|
get value() {
|
|
59
154
|
return this._value
|
|
60
155
|
}
|
|
61
156
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Gets the domain of the cookie.
|
|
159
|
+
* @returns {string} The domain of the cookie.
|
|
160
|
+
*/
|
|
66
161
|
get domain() {
|
|
67
162
|
return this._domain
|
|
68
163
|
}
|
|
69
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Gets the path of the cookie.
|
|
167
|
+
* @returns {string} The path of the cookie.
|
|
168
|
+
*/
|
|
70
169
|
get path() {
|
|
71
170
|
return this._path
|
|
72
171
|
}
|
|
73
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Gets the expiration date of the cookie.
|
|
175
|
+
* @returns {number} The expiration date of the cookie.
|
|
176
|
+
*/
|
|
74
177
|
get expires() {
|
|
75
178
|
return this._expires
|
|
76
179
|
}
|
|
77
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Gets the size of the cookie.
|
|
183
|
+
* @returns {number} The size of the cookie.
|
|
184
|
+
*/
|
|
78
185
|
get size() {
|
|
79
186
|
return this._size
|
|
80
187
|
}
|
|
81
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Checks if the cookie is HTTP-only.
|
|
191
|
+
* @returns {boolean} True if the cookie is HTTP-only, false otherwise.
|
|
192
|
+
*/
|
|
82
193
|
get httpOnly() {
|
|
83
194
|
return this._httpOnly
|
|
84
195
|
}
|
|
85
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Checks if the cookie is secure.
|
|
199
|
+
* @returns {boolean} True if the cookie is secure, false otherwise.
|
|
200
|
+
*/
|
|
86
201
|
get secure() {
|
|
87
202
|
return this._secure
|
|
88
203
|
}
|
|
89
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Gets the same-site attribute of the cookie.
|
|
207
|
+
* @returns {string} The same-site attribute of the cookie.
|
|
208
|
+
*/
|
|
90
209
|
get sameSite() {
|
|
91
210
|
return this._sameSite
|
|
92
211
|
}
|
|
93
212
|
}
|
|
94
213
|
|
|
95
214
|
// No tests written for FetchTimingInfo. Must be updated after browsers implment it and corresponding WPT test are written.
|
|
215
|
+
/**
|
|
216
|
+
* Represents the time of each part of the request.
|
|
217
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-FetchTimingInfo.
|
|
218
|
+
* @class
|
|
219
|
+
*/
|
|
96
220
|
class FetchTimingInfo {
|
|
97
221
|
constructor(
|
|
98
222
|
originTime,
|
|
@@ -124,59 +248,128 @@ class FetchTimingInfo {
|
|
|
124
248
|
this._responseEnd = responseEnd
|
|
125
249
|
}
|
|
126
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Gets the origin time.
|
|
253
|
+
*
|
|
254
|
+
* @returns {number} The origin time.
|
|
255
|
+
*/
|
|
127
256
|
get originTime() {
|
|
128
257
|
return this._originTime
|
|
129
258
|
}
|
|
130
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Get the request time.
|
|
262
|
+
*
|
|
263
|
+
* @returns {number} The request time.
|
|
264
|
+
*/
|
|
131
265
|
get requestTime() {
|
|
132
266
|
return this._requestTime
|
|
133
267
|
}
|
|
134
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Gets the timestamp when the redirect started.
|
|
271
|
+
*
|
|
272
|
+
* @returns {number} The timestamp when the redirect started.
|
|
273
|
+
*/
|
|
135
274
|
get redirectStart() {
|
|
136
275
|
return this._redirectStart
|
|
137
276
|
}
|
|
138
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Gets the timestamp when the redirect ended.
|
|
280
|
+
*
|
|
281
|
+
* @returns {number} The timestamp when the redirect ended.
|
|
282
|
+
*/
|
|
139
283
|
get redirectEnd() {
|
|
140
284
|
return this._redirectEnd
|
|
141
285
|
}
|
|
142
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Gets the timestamp when the fetch started.
|
|
289
|
+
*
|
|
290
|
+
* @returns {number} The timestamp when the fetch started.
|
|
291
|
+
*/
|
|
143
292
|
get fetchStart() {
|
|
144
293
|
return this._fetchStart
|
|
145
294
|
}
|
|
146
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Gets the timestamp when the domain lookup started.
|
|
298
|
+
*
|
|
299
|
+
* @returns {number} The timestamp when the domain lookup started.
|
|
300
|
+
*/
|
|
147
301
|
get dnsStart() {
|
|
148
302
|
return this._dnsStart
|
|
149
303
|
}
|
|
150
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Gets the timestamp when the domain lookup ended.
|
|
307
|
+
*
|
|
308
|
+
* @returns {number} The timestamp when the domain lookup ended.
|
|
309
|
+
*/
|
|
151
310
|
get dnsEnd() {
|
|
152
311
|
return this._dnsEnd
|
|
153
312
|
}
|
|
154
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Gets the timestamp when the connection started.
|
|
316
|
+
*
|
|
317
|
+
* @returns {number} The timestamp when the connection ended.
|
|
318
|
+
*/
|
|
155
319
|
get connectStart() {
|
|
156
320
|
return this._connectStart
|
|
157
321
|
}
|
|
158
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Gets the timestamp when the connection ended.
|
|
325
|
+
*
|
|
326
|
+
* @returns {number} The timestamp when the connection ended.
|
|
327
|
+
*/
|
|
159
328
|
get connectEnd() {
|
|
160
329
|
return this._connectEnd
|
|
161
330
|
}
|
|
162
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Gets the timestamp when the secure connection started.
|
|
334
|
+
*
|
|
335
|
+
* @returns {number} The timestamp when the secure connection started.
|
|
336
|
+
*/
|
|
163
337
|
get tlsStart() {
|
|
164
338
|
return this._tlsStart
|
|
165
339
|
}
|
|
166
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Gets the timestamp when the request started.
|
|
343
|
+
*
|
|
344
|
+
* @returns {number} The timestamp when the request started.
|
|
345
|
+
*/
|
|
167
346
|
get requestStart() {
|
|
168
347
|
return this._requestStart
|
|
169
348
|
}
|
|
170
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Gets the timestamp when the response started.
|
|
352
|
+
*
|
|
353
|
+
* @returns {number} The timestamp when the response started.
|
|
354
|
+
*/
|
|
171
355
|
get responseStart() {
|
|
172
356
|
return this._responseStart
|
|
173
357
|
}
|
|
174
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Gets the timestamp when the response ended.
|
|
361
|
+
*
|
|
362
|
+
* @returns {number} The timestamp when the response ended.
|
|
363
|
+
*/
|
|
175
364
|
get responseEnd() {
|
|
176
365
|
return this._responseEnd
|
|
177
366
|
}
|
|
178
367
|
}
|
|
179
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Represents the data of a network request.
|
|
371
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-RequestData.
|
|
372
|
+
*/
|
|
180
373
|
class RequestData {
|
|
181
374
|
constructor(request, url, method, headers, cookies, headersSize, bodySize, timings) {
|
|
182
375
|
this._request = request
|
|
@@ -186,9 +379,8 @@ class RequestData {
|
|
|
186
379
|
headers.forEach((header) => {
|
|
187
380
|
let name = header.name
|
|
188
381
|
let value = 'value' in header ? header.value : null
|
|
189
|
-
let binaryValue = 'binaryValue' in header ? header.binaryValue : null
|
|
190
382
|
|
|
191
|
-
this._headers.push(new Header(name, value,
|
|
383
|
+
this._headers.push(new Header(name, new BytesValue(value.type, value.value)))
|
|
192
384
|
})
|
|
193
385
|
|
|
194
386
|
this._cookies = []
|
|
@@ -201,10 +393,9 @@ class RequestData {
|
|
|
201
393
|
let secure = cookie.secure
|
|
202
394
|
let sameSite = cookie.sameSite
|
|
203
395
|
let value = 'value' in cookie ? cookie.value : null
|
|
204
|
-
let binaryValue = 'binaryValue' in cookie ? cookie.binaryValue : null
|
|
205
396
|
let expires = 'expires' in cookie ? cookie.expires : null
|
|
206
397
|
|
|
207
|
-
this._cookies.push(new Cookie(name, value,
|
|
398
|
+
this._cookies.push(new Cookie(name, value, domain, path, size, httpOnly, secure, sameSite, expires))
|
|
208
399
|
})
|
|
209
400
|
this._headersSize = headersSize
|
|
210
401
|
this._bodySize = bodySize
|
|
@@ -225,39 +416,75 @@ class RequestData {
|
|
|
225
416
|
)
|
|
226
417
|
}
|
|
227
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Get the request id.
|
|
421
|
+
* @returns {string} The request id.
|
|
422
|
+
*/
|
|
228
423
|
get request() {
|
|
229
424
|
return this._request
|
|
230
425
|
}
|
|
231
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Get the URL of the request.
|
|
429
|
+
* @returns {string} The URL of the request.
|
|
430
|
+
*/
|
|
232
431
|
get url() {
|
|
233
432
|
return this._url
|
|
234
433
|
}
|
|
235
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Get the HTTP method of the request.
|
|
437
|
+
* @returns {string} The HTTP method of the request.
|
|
438
|
+
*/
|
|
236
439
|
get method() {
|
|
237
440
|
return this._method
|
|
238
441
|
}
|
|
239
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Get the headers of the request.
|
|
445
|
+
* @returns {Header[]} An array of header objects.
|
|
446
|
+
*/
|
|
240
447
|
get headers() {
|
|
241
448
|
return this._headers
|
|
242
449
|
}
|
|
243
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Get the cookies of the request.
|
|
453
|
+
* @returns {Cookie[]} An array of cookie objects.
|
|
454
|
+
*/
|
|
244
455
|
get cookies() {
|
|
245
456
|
return this._cookies
|
|
246
457
|
}
|
|
247
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Get the size of the headers in bytes.
|
|
461
|
+
* @returns {number} The size of the headers in bytes.
|
|
462
|
+
*/
|
|
248
463
|
get headersSize() {
|
|
249
464
|
return this._headersSize
|
|
250
465
|
}
|
|
251
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Get the size of the request body in bytes.
|
|
469
|
+
* @returns {number} The size of the request body in bytes.
|
|
470
|
+
*/
|
|
252
471
|
get bodySize() {
|
|
253
472
|
return this._bodySize
|
|
254
473
|
}
|
|
255
474
|
|
|
475
|
+
/**
|
|
476
|
+
* Get the timing information of the request.
|
|
477
|
+
* @returns {FetchTimingInfo} The timing information of the request.
|
|
478
|
+
*/
|
|
256
479
|
get timings() {
|
|
257
480
|
return this._timings
|
|
258
481
|
}
|
|
259
482
|
}
|
|
260
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Represents the base parameters for a network request.
|
|
486
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-BaseParameters.
|
|
487
|
+
*/
|
|
261
488
|
class BaseParameters {
|
|
262
489
|
constructor(id, navigation, redirectCount, request, timestamp) {
|
|
263
490
|
this._id = id
|
|
@@ -279,28 +506,60 @@ class BaseParameters {
|
|
|
279
506
|
this._timestamp = timestamp
|
|
280
507
|
}
|
|
281
508
|
|
|
509
|
+
/**
|
|
510
|
+
* Gets the browsing context ID of the network request.
|
|
511
|
+
* @returns {string|null} The browsing context ID of the network request.
|
|
512
|
+
*/
|
|
282
513
|
get id() {
|
|
283
514
|
return this._id
|
|
284
515
|
}
|
|
285
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Gets the navigation information associated with the network request.
|
|
519
|
+
* @returns {NavigationInfo|null} The navigation information associated with the network request, or null if not available.
|
|
520
|
+
*/
|
|
286
521
|
get navigation() {
|
|
287
522
|
return this._navigation
|
|
288
523
|
}
|
|
289
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Gets the number of redirects that occurred during the network request.
|
|
527
|
+
* @returns {number} The number of redirects that occurred during the network request.
|
|
528
|
+
*/
|
|
290
529
|
get redirectCount() {
|
|
291
530
|
return this._redirectCount
|
|
292
531
|
}
|
|
293
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Gets the request data for the network request.
|
|
535
|
+
* @returns {RequestData} The request data for the network request.
|
|
536
|
+
*/
|
|
294
537
|
get request() {
|
|
295
538
|
return this._request
|
|
296
539
|
}
|
|
297
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Gets the timestamp of the network request.
|
|
543
|
+
* @returns {number} The timestamp of the network request.
|
|
544
|
+
*/
|
|
298
545
|
get timestamp() {
|
|
299
546
|
return this._timestamp
|
|
300
547
|
}
|
|
301
548
|
}
|
|
302
549
|
|
|
550
|
+
/**
|
|
551
|
+
* Represents source in the network.
|
|
552
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-Initiator.
|
|
553
|
+
*/
|
|
303
554
|
class Initiator {
|
|
555
|
+
/**
|
|
556
|
+
* Constructs a new Initiator instance.
|
|
557
|
+
* @param {string} type - The type of the initiator.
|
|
558
|
+
* @param {number} columnNumber - The column number.
|
|
559
|
+
* @param {number} lineNumber - The line number.
|
|
560
|
+
* @param {string} stackTrace - The stack trace.
|
|
561
|
+
* @param {string} request - The request id.
|
|
562
|
+
*/
|
|
304
563
|
constructor(type, columnNumber, lineNumber, stackTrace, request) {
|
|
305
564
|
this._type = type
|
|
306
565
|
this._columnNumber = columnNumber
|
|
@@ -309,27 +568,53 @@ class Initiator {
|
|
|
309
568
|
this._request = request
|
|
310
569
|
}
|
|
311
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Gets the type of the initiator.
|
|
573
|
+
* @returns {string} The type of the initiator.
|
|
574
|
+
*/
|
|
312
575
|
get type() {
|
|
313
576
|
return this._type
|
|
314
577
|
}
|
|
315
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Gets the column number.
|
|
581
|
+
* @returns {number} The column number.
|
|
582
|
+
*/
|
|
316
583
|
get columnNumber() {
|
|
317
584
|
return this._columnNumber
|
|
318
585
|
}
|
|
319
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Gets the line number.
|
|
589
|
+
* @returns {number} The line number.
|
|
590
|
+
*/
|
|
320
591
|
get lineNumber() {
|
|
321
592
|
return this._lineNumber
|
|
322
593
|
}
|
|
323
594
|
|
|
595
|
+
/**
|
|
596
|
+
* Gets the stack trace.
|
|
597
|
+
* @returns {string} The stack trace.
|
|
598
|
+
*/
|
|
324
599
|
get stackTrace() {
|
|
325
600
|
return this._stackTrace
|
|
326
601
|
}
|
|
327
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Gets the request ID.
|
|
605
|
+
* @returns {string} The request ID.
|
|
606
|
+
*/
|
|
328
607
|
get request() {
|
|
329
608
|
return this._request
|
|
330
609
|
}
|
|
331
610
|
}
|
|
332
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Represents the BeforeRequestSent event parameters.
|
|
614
|
+
* @class
|
|
615
|
+
* @extends BaseParameters
|
|
616
|
+
* Described in https://w3c.github.io/webdriver-bidi/#event-network-beforeSendRequest.
|
|
617
|
+
*/
|
|
333
618
|
class BeforeRequestSent extends BaseParameters {
|
|
334
619
|
constructor(id, navigation, redirectCount, request, timestamp, initiator) {
|
|
335
620
|
super(id, navigation, redirectCount, request, timestamp)
|
|
@@ -342,22 +627,49 @@ class BeforeRequestSent extends BaseParameters {
|
|
|
342
627
|
)
|
|
343
628
|
}
|
|
344
629
|
|
|
630
|
+
/**
|
|
631
|
+
* Get the initiator of the request.
|
|
632
|
+
* @returns {Initiator} The initiator object.
|
|
633
|
+
*/
|
|
345
634
|
get initiator() {
|
|
346
635
|
return this._initiator
|
|
347
636
|
}
|
|
348
637
|
}
|
|
349
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Represents the FetchError event parameters.
|
|
641
|
+
* Described https://w3c.github.io/webdriver-bidi/#event-network-fetchError
|
|
642
|
+
* @extends BaseParameters
|
|
643
|
+
*/
|
|
350
644
|
class FetchError extends BaseParameters {
|
|
645
|
+
/**
|
|
646
|
+
* Creates a new FetchError instance.
|
|
647
|
+
* @param {string} id - The ID of the error.
|
|
648
|
+
* @param {string} navigation - The navigation information.
|
|
649
|
+
* @param {number} redirectCount - The number of redirects.
|
|
650
|
+
* @param {RequestData} request - The request object.
|
|
651
|
+
* @param {number} timestamp - The timestamp of the error.
|
|
652
|
+
* @param {string} errorText - The error text.
|
|
653
|
+
*/
|
|
351
654
|
constructor(id, navigation, redirectCount, request, timestamp, errorText) {
|
|
352
655
|
super(id, navigation, redirectCount, request, timestamp)
|
|
353
656
|
this._errorText = errorText
|
|
354
657
|
}
|
|
355
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Gets the error text.
|
|
661
|
+
* @returns {string} The error text.
|
|
662
|
+
*/
|
|
356
663
|
get errorText() {
|
|
357
664
|
return this._errorText
|
|
358
665
|
}
|
|
359
666
|
}
|
|
360
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Represents the response data received from a network request.
|
|
670
|
+
* Described in https://w3c.github.io/webdriver-bidi/#type-network-ResponseData.
|
|
671
|
+
* @class
|
|
672
|
+
*/
|
|
361
673
|
class ResponseData {
|
|
362
674
|
constructor(
|
|
363
675
|
url,
|
|
@@ -385,51 +697,112 @@ class ResponseData {
|
|
|
385
697
|
this._content = content
|
|
386
698
|
}
|
|
387
699
|
|
|
700
|
+
/**
|
|
701
|
+
* Get the URL.
|
|
702
|
+
*
|
|
703
|
+
* @returns {string} The URL.
|
|
704
|
+
*/
|
|
388
705
|
get url() {
|
|
389
706
|
return this._url
|
|
390
707
|
}
|
|
391
708
|
|
|
709
|
+
/**
|
|
710
|
+
* Get the protocol.
|
|
711
|
+
*
|
|
712
|
+
* @returns {string} The protocol.
|
|
713
|
+
*/
|
|
392
714
|
get protocol() {
|
|
393
715
|
return this._protocol
|
|
394
716
|
}
|
|
395
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Get the HTTP status.
|
|
720
|
+
*
|
|
721
|
+
* @returns {string} The HTTP status.
|
|
722
|
+
*/
|
|
396
723
|
get status() {
|
|
397
724
|
return this._status
|
|
398
725
|
}
|
|
399
726
|
|
|
727
|
+
/**
|
|
728
|
+
* Gets the status text.
|
|
729
|
+
*
|
|
730
|
+
* @returns {string} The status text.
|
|
731
|
+
*/
|
|
400
732
|
get statusText() {
|
|
401
733
|
return this._statusText
|
|
402
734
|
}
|
|
403
735
|
|
|
736
|
+
/**
|
|
737
|
+
* Gets the value indicating whether the data is retrieved from cache.
|
|
738
|
+
*
|
|
739
|
+
* @returns {boolean} The value indicating whether the data is retrieved from cache.
|
|
740
|
+
*/
|
|
404
741
|
get fromCache() {
|
|
405
742
|
return this._fromCache
|
|
406
743
|
}
|
|
407
744
|
|
|
745
|
+
/**
|
|
746
|
+
* Get the headers.
|
|
747
|
+
*
|
|
748
|
+
* @returns {Object} The headers object.
|
|
749
|
+
*/
|
|
408
750
|
get headers() {
|
|
409
751
|
return this._headers
|
|
410
752
|
}
|
|
411
753
|
|
|
754
|
+
/**
|
|
755
|
+
* The MIME type of the network resource.
|
|
756
|
+
*
|
|
757
|
+
* @type {string}
|
|
758
|
+
*/
|
|
412
759
|
get mimeType() {
|
|
413
760
|
return this._mimeType
|
|
414
761
|
}
|
|
415
762
|
|
|
763
|
+
/**
|
|
764
|
+
* Gets the number of bytes received.
|
|
765
|
+
*
|
|
766
|
+
* @returns {number} The number of bytes received.
|
|
767
|
+
*/
|
|
416
768
|
get bytesReceived() {
|
|
417
769
|
return this._bytesReceived
|
|
418
770
|
}
|
|
419
771
|
|
|
772
|
+
/**
|
|
773
|
+
* Get the size of the headers.
|
|
774
|
+
*
|
|
775
|
+
* @returns {number} The size of the headers.
|
|
776
|
+
*/
|
|
420
777
|
get headerSize() {
|
|
421
778
|
return this._headersSize
|
|
422
779
|
}
|
|
423
780
|
|
|
781
|
+
/**
|
|
782
|
+
* Get the size of the body.
|
|
783
|
+
*
|
|
784
|
+
* @returns {number} The size of the body.
|
|
785
|
+
*/
|
|
424
786
|
get bodySize() {
|
|
425
787
|
return this._bodySize
|
|
426
788
|
}
|
|
427
789
|
|
|
790
|
+
/**
|
|
791
|
+
* Gets the content.
|
|
792
|
+
*
|
|
793
|
+
* @returns {any} The content.
|
|
794
|
+
*/
|
|
428
795
|
get content() {
|
|
429
796
|
return this._content
|
|
430
797
|
}
|
|
431
798
|
}
|
|
432
799
|
|
|
800
|
+
/**
|
|
801
|
+
* Represents the ResponseStarted event parameters.
|
|
802
|
+
* Described in https://w3c.github.io/webdriver-bidi/#event-network-responseStarted.
|
|
803
|
+
* @class
|
|
804
|
+
* @extends BaseParameters
|
|
805
|
+
*/
|
|
433
806
|
class ResponseStarted extends BaseParameters {
|
|
434
807
|
constructor(id, navigation, redirectCount, request, timestamp, response) {
|
|
435
808
|
super(id, navigation, redirectCount, request, timestamp)
|
|
@@ -448,9 +821,13 @@ class ResponseStarted extends BaseParameters {
|
|
|
448
821
|
)
|
|
449
822
|
}
|
|
450
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Get the response data.
|
|
826
|
+
* @returns {ResponseData} The response data.
|
|
827
|
+
*/
|
|
451
828
|
get response() {
|
|
452
829
|
return this._response
|
|
453
830
|
}
|
|
454
831
|
}
|
|
455
832
|
|
|
456
|
-
module.exports = { BeforeRequestSent, ResponseStarted, FetchError }
|
|
833
|
+
module.exports = { Header, BytesValue, Cookie, SameSite, BeforeRequestSent, ResponseStarted, FetchError }
|