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