@browserless.io/browserless 2.25.0 → 2.25.2

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/build/browsers/index.js +18 -11
  3. package/build/limiter.spec.js +1 -1
  4. package/build/routes/chrome/http/content.post.body.json +9 -9
  5. package/build/routes/chrome/http/pdf.post.body.json +9 -9
  6. package/build/routes/chrome/http/scrape.post.body.json +9 -9
  7. package/build/routes/chrome/http/scrape.post.response.json +1 -1
  8. package/build/routes/chrome/http/screenshot.post.body.json +9 -9
  9. package/build/routes/chrome/tests/kill-sessions.spec.js +1 -1
  10. package/build/routes/chrome/tests/page-websocket.spec.js +0 -3
  11. package/build/routes/chromium/http/content.post.body.json +9 -9
  12. package/build/routes/chromium/http/pdf.post.body.json +9 -9
  13. package/build/routes/chromium/http/scrape.post.body.json +9 -9
  14. package/build/routes/chromium/http/scrape.post.response.json +1 -1
  15. package/build/routes/chromium/http/screenshot.post.body.json +9 -9
  16. package/build/routes/chromium/tests/kill-sessions.spec.js +1 -1
  17. package/build/routes/chromium/tests/page-websocket.spec.js +0 -3
  18. package/build/routes/chromium/tests/websocket.spec.js +0 -3
  19. package/build/routes/edge/http/content.post.body.json +9 -9
  20. package/build/routes/edge/http/pdf.post.body.json +9 -9
  21. package/build/routes/edge/http/scrape.post.body.json +9 -9
  22. package/build/routes/edge/http/scrape.post.response.json +1 -1
  23. package/build/routes/edge/http/screenshot.post.body.json +9 -9
  24. package/build/routes/edge/tests/page-websocket.spec.js +0 -3
  25. package/build/routes/firefox/tests/kill-sessions.spec.js +1 -1
  26. package/build/routes/webkit/tests/kill-sessions.spec.js +1 -1
  27. package/build/routes/webkit/tests/websocket.spec.js +0 -3
  28. package/docker/multi/Dockerfile +4 -4
  29. package/package.json +11 -11
  30. package/scripts/test.sh +1 -1
  31. package/src/browsers/index.ts +38 -14
  32. package/src/limiter.spec.ts +1 -1
  33. package/src/routes/chrome/tests/kill-sessions.spec.ts +1 -1
  34. package/src/routes/chrome/tests/page-websocket.spec.ts +0 -4
  35. package/src/routes/chromium/tests/kill-sessions.spec.ts +1 -1
  36. package/src/routes/chromium/tests/page-websocket.spec.ts +0 -4
  37. package/src/routes/chromium/tests/websocket.spec.ts +0 -4
  38. package/src/routes/edge/tests/page-websocket.spec.ts +0 -4
  39. package/src/routes/firefox/tests/kill-sessions.spec.ts +1 -1
  40. package/src/routes/webkit/tests/kill-sessions.spec.ts +1 -1
  41. package/src/routes/webkit/tests/websocket.spec.ts +0 -4
  42. package/static/docs/swagger.json +15 -15
  43. package/static/docs/swagger.min.json +14 -14
  44. package/static/function/client.js +33 -20
  45. package/static/function/index.html +33 -20
@@ -38,7 +38,7 @@ describe('/kill API', function () {
38
38
  }
39
39
  expect(errorThrown1.message).contains('closed');
40
40
  expect(errorThrown2.message).contains('closed');
41
- }).timeout(45000);
41
+ });
42
42
  it('Kill session by browserId', async () => {
43
43
  await start();
44
44
  const browser = await puppeteer.connect({
@@ -3,9 +3,6 @@ import puppeteer, { Connection } from 'puppeteer-core';
3
3
  import { NodeWebSocketTransport } from 'puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js';
4
4
  import { expect } from 'chai';
5
5
  describe('WebSocket Page API', function () {
6
- // Server shutdown can take a few seconds
7
- // and so can these tests :/
8
- this.timeout(5000);
9
6
  let browserless;
10
7
  const start = ({ config = new Config(), metrics = new Metrics(), } = {}) => {
11
8
  browserless = new Browserless({ config, metrics });
@@ -4,9 +4,6 @@ import { deleteAsync } from 'del';
4
4
  import { expect } from 'chai';
5
5
  import puppeteer from 'puppeteer-core';
6
6
  describe('Chromium WebSocket API', function () {
7
- // Server shutdown can take a few seconds
8
- // and so can these tests :/
9
- this.timeout(5000);
10
7
  let browserless;
11
8
  const start = ({ config = new Config(), metrics = new Metrics(), } = {}) => {
12
9
  browserless = new Browserless({ config, metrics });
@@ -312,7 +312,7 @@
312
312
  "type": "string"
313
313
  },
314
314
  "partitionKey": {
315
- "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
315
+ "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
316
316
  "anyOf": [
317
317
  {
318
318
  "$ref": "#/definitions/CookiePartitionKey"
@@ -463,14 +463,14 @@
463
463
  "length": {
464
464
  "type": "number"
465
465
  },
466
- "__@toStringTag@301850": {
466
+ "__@toStringTag@276600": {
467
467
  "type": "string",
468
468
  "const": "Uint8Array"
469
469
  }
470
470
  },
471
471
  "required": [
472
472
  "BYTES_PER_ELEMENT",
473
- "__@toStringTag@301850",
473
+ "__@toStringTag@276600",
474
474
  "buffer",
475
475
  "byteLength",
476
476
  "byteOffset",
@@ -505,13 +505,13 @@
505
505
  "byteLength": {
506
506
  "type": "number"
507
507
  },
508
- "__@toStringTag@301850": {
508
+ "__@toStringTag@276600": {
509
509
  "type": "string"
510
510
  }
511
511
  },
512
512
  "additionalProperties": false,
513
513
  "required": [
514
- "__@toStringTag@301850",
514
+ "__@toStringTag@276600",
515
515
  "byteLength"
516
516
  ]
517
517
  },
@@ -521,18 +521,18 @@
521
521
  "byteLength": {
522
522
  "type": "number"
523
523
  },
524
- "__@species@301888": {
524
+ "__@species@276638": {
525
525
  "$ref": "#/definitions/SharedArrayBuffer"
526
526
  },
527
- "__@toStringTag@301850": {
527
+ "__@toStringTag@276600": {
528
528
  "type": "string",
529
529
  "const": "SharedArrayBuffer"
530
530
  }
531
531
  },
532
532
  "additionalProperties": false,
533
533
  "required": [
534
- "__@species@301888",
535
- "__@toStringTag@301850",
534
+ "__@species@276638",
535
+ "__@toStringTag@276600",
536
536
  "byteLength"
537
537
  ]
538
538
  },
@@ -314,7 +314,7 @@
314
314
  "type": "string"
315
315
  },
316
316
  "partitionKey": {
317
- "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
317
+ "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
318
318
  "anyOf": [
319
319
  {
320
320
  "$ref": "#/definitions/CookiePartitionKey"
@@ -608,14 +608,14 @@
608
608
  "length": {
609
609
  "type": "number"
610
610
  },
611
- "__@toStringTag@339568": {
611
+ "__@toStringTag@389578": {
612
612
  "type": "string",
613
613
  "const": "Uint8Array"
614
614
  }
615
615
  },
616
616
  "required": [
617
617
  "BYTES_PER_ELEMENT",
618
- "__@toStringTag@339568",
618
+ "__@toStringTag@389578",
619
619
  "buffer",
620
620
  "byteLength",
621
621
  "byteOffset",
@@ -650,13 +650,13 @@
650
650
  "byteLength": {
651
651
  "type": "number"
652
652
  },
653
- "__@toStringTag@339568": {
653
+ "__@toStringTag@389578": {
654
654
  "type": "string"
655
655
  }
656
656
  },
657
657
  "additionalProperties": false,
658
658
  "required": [
659
- "__@toStringTag@339568",
659
+ "__@toStringTag@389578",
660
660
  "byteLength"
661
661
  ]
662
662
  },
@@ -666,18 +666,18 @@
666
666
  "byteLength": {
667
667
  "type": "number"
668
668
  },
669
- "__@species@339606": {
669
+ "__@species@389616": {
670
670
  "$ref": "#/definitions/SharedArrayBuffer"
671
671
  },
672
- "__@toStringTag@339568": {
672
+ "__@toStringTag@389578": {
673
673
  "type": "string",
674
674
  "const": "SharedArrayBuffer"
675
675
  }
676
676
  },
677
677
  "additionalProperties": false,
678
678
  "required": [
679
- "__@species@339606",
680
- "__@toStringTag@339568",
679
+ "__@species@389616",
680
+ "__@toStringTag@389578",
681
681
  "byteLength"
682
682
  ]
683
683
  },
@@ -323,7 +323,7 @@
323
323
  "type": "string"
324
324
  },
325
325
  "partitionKey": {
326
- "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
326
+ "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
327
327
  "anyOf": [
328
328
  {
329
329
  "$ref": "#/definitions/CookiePartitionKey"
@@ -510,14 +510,14 @@
510
510
  "length": {
511
511
  "type": "number"
512
512
  },
513
- "__@toStringTag@389787": {
513
+ "__@toStringTag@402284": {
514
514
  "type": "string",
515
515
  "const": "Uint8Array"
516
516
  }
517
517
  },
518
518
  "required": [
519
519
  "BYTES_PER_ELEMENT",
520
- "__@toStringTag@389787",
520
+ "__@toStringTag@402284",
521
521
  "buffer",
522
522
  "byteLength",
523
523
  "byteOffset",
@@ -552,13 +552,13 @@
552
552
  "byteLength": {
553
553
  "type": "number"
554
554
  },
555
- "__@toStringTag@389787": {
555
+ "__@toStringTag@402284": {
556
556
  "type": "string"
557
557
  }
558
558
  },
559
559
  "additionalProperties": false,
560
560
  "required": [
561
- "__@toStringTag@389787",
561
+ "__@toStringTag@402284",
562
562
  "byteLength"
563
563
  ]
564
564
  },
@@ -568,18 +568,18 @@
568
568
  "byteLength": {
569
569
  "type": "number"
570
570
  },
571
- "__@species@389825": {
571
+ "__@species@402322": {
572
572
  "$ref": "#/definitions/SharedArrayBuffer"
573
573
  },
574
- "__@toStringTag@389787": {
574
+ "__@toStringTag@402284": {
575
575
  "type": "string",
576
576
  "const": "SharedArrayBuffer"
577
577
  }
578
578
  },
579
579
  "additionalProperties": false,
580
580
  "required": [
581
- "__@species@389825",
582
- "__@toStringTag@389787",
581
+ "__@species@402322",
582
+ "__@toStringTag@402284",
583
583
  "byteLength"
584
584
  ]
585
585
  },
@@ -247,7 +247,7 @@
247
247
  "type": "string"
248
248
  },
249
249
  "partitionKey": {
250
- "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
250
+ "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
251
251
  "anyOf": [
252
252
  {
253
253
  "$ref": "#/definitions/CookiePartitionKey"
@@ -320,7 +320,7 @@
320
320
  "type": "string"
321
321
  },
322
322
  "partitionKey": {
323
- "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
323
+ "description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
324
324
  "anyOf": [
325
325
  {
326
326
  "$ref": "#/definitions/CookiePartitionKey"
@@ -553,14 +553,14 @@
553
553
  "length": {
554
554
  "type": "number"
555
555
  },
556
- "__@toStringTag@402569": {
556
+ "__@toStringTag@427556": {
557
557
  "type": "string",
558
558
  "const": "Uint8Array"
559
559
  }
560
560
  },
561
561
  "required": [
562
562
  "BYTES_PER_ELEMENT",
563
- "__@toStringTag@402569",
563
+ "__@toStringTag@427556",
564
564
  "buffer",
565
565
  "byteLength",
566
566
  "byteOffset",
@@ -595,13 +595,13 @@
595
595
  "byteLength": {
596
596
  "type": "number"
597
597
  },
598
- "__@toStringTag@402569": {
598
+ "__@toStringTag@427556": {
599
599
  "type": "string"
600
600
  }
601
601
  },
602
602
  "additionalProperties": false,
603
603
  "required": [
604
- "__@toStringTag@402569",
604
+ "__@toStringTag@427556",
605
605
  "byteLength"
606
606
  ]
607
607
  },
@@ -611,18 +611,18 @@
611
611
  "byteLength": {
612
612
  "type": "number"
613
613
  },
614
- "__@species@402607": {
614
+ "__@species@427594": {
615
615
  "$ref": "#/definitions/SharedArrayBuffer"
616
616
  },
617
- "__@toStringTag@402569": {
617
+ "__@toStringTag@427556": {
618
618
  "type": "string",
619
619
  "const": "SharedArrayBuffer"
620
620
  }
621
621
  },
622
622
  "additionalProperties": false,
623
623
  "required": [
624
- "__@species@402607",
625
- "__@toStringTag@402569",
624
+ "__@species@427594",
625
+ "__@toStringTag@427556",
626
626
  "byteLength"
627
627
  ]
628
628
  },
@@ -3,9 +3,6 @@ import puppeteer, { Connection } from 'puppeteer-core';
3
3
  import { NodeWebSocketTransport } from 'puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js';
4
4
  import { expect } from 'chai';
5
5
  describe('WebSocket Page API', function () {
6
- // Server shutdown can take a few seconds
7
- // and so can these tests :/
8
- this.timeout(5000);
9
6
  let browserless;
10
7
  const start = ({ config = new Config(), metrics = new Metrics(), } = {}) => {
11
8
  browserless = new Browserless({ config, metrics });
@@ -34,7 +34,7 @@ describe('/kill API firefox', function () {
34
34
  }
35
35
  expect(errorThrown1.message).contains('closed');
36
36
  expect(errorThrown2.message).contains('closed');
37
- }).timeout(45000);
37
+ });
38
38
  it('Kill session by browserId', async () => {
39
39
  await start();
40
40
  const browser = await firefox.connect(`ws://localhost:3000/playwright/firefox?token=browserless`);
@@ -34,7 +34,7 @@ describe('/kill API webkit', function () {
34
34
  }
35
35
  expect(errorThrown1.message).contains('closed');
36
36
  expect(errorThrown2.message).contains('closed');
37
- }).timeout(45000);
37
+ });
38
38
  it('Kill session by browserId', async () => {
39
39
  await start();
40
40
  const browser = await webkit.connect(`ws://localhost:3000/webkit/playwright?token=browserless`);
@@ -2,9 +2,6 @@ import { Browserless, Config, Metrics, sleep, } from '@browserless.io/browserles
2
2
  import { expect } from 'chai';
3
3
  import { webkit } from 'playwright-core';
4
4
  describe('Webkit Websocket API', function () {
5
- // Server shutdown can take a few seconds
6
- // and so can these tests :/
7
- this.timeout(5000);
8
5
  let browserless;
9
6
  const start = ({ config = new Config(), metrics = new Metrics(), } = {}) => {
10
7
  browserless = new Browserless({ config, metrics });
@@ -28,17 +28,17 @@ RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula sele
28
28
  fonts-open-sans \
29
29
  libwebp-dev
30
30
 
31
- # Chrome stable is only supported on non-ARM builds
31
+ # Chrome stable and Edge is only supported on non-ARM builds
32
32
  # so it's installation is conditional on whether or not amd64
33
33
  RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
34
- ./node_modules/playwright-core/cli.js install --with-deps chrome; \
34
+ ./node_modules/playwright-core/cli.js install --with-deps chrome msedge; \
35
35
  else \
36
- rm -rf ./src/routes/chrome; \
36
+ rm -rf ./src/routes/chrome ./src/routes/edge; \
37
37
  fi
38
38
 
39
39
  # NOTE it's important to not use npx playwright-core here since it'll likely install
40
40
  # a more recent version than we potentially have in our own package.json
41
- RUN ./node_modules/playwright-core/cli.js install --with-deps chromium firefox webkit msedge &&\
41
+ RUN ./node_modules/playwright-core/cli.js install --with-deps chromium firefox webkit &&\
42
42
  npm run build &&\
43
43
  npm run build:function &&\
44
44
  npm prune production &&\
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserless.io/browserless",
3
- "version": "2.25.0",
3
+ "version": "2.25.2",
4
4
  "license": "SSPL",
5
5
  "description": "The browserless platform",
6
6
  "author": "browserless.io",
@@ -51,18 +51,18 @@
51
51
  "debug": "^4.4.0",
52
52
  "del": "^8.0.0",
53
53
  "enjoi": "^9.0.1",
54
- "file-type": "^20.1.0",
54
+ "file-type": "^20.4.0",
55
55
  "get-port": "^7.1.0",
56
56
  "gradient-string": "^3.0.0",
57
57
  "http-proxy": "^1.18.1",
58
- "lighthouse": "^12.3.0",
58
+ "lighthouse": "^12.4.0",
59
59
  "micromatch": "^4.0.8",
60
60
  "playwright-1.46": "npm:playwright-core@1.46.1",
61
61
  "playwright-1.47": "npm:playwright-core@1.47.2",
62
62
  "playwright-1.48": "npm:playwright-core@1.48.2",
63
63
  "playwright-1.49": "npm:playwright-core@1.49.1",
64
64
  "playwright-core": "1.50.1",
65
- "puppeteer-core": "24.2.1",
65
+ "puppeteer-core": "24.3.0",
66
66
  "puppeteer-extra": "^3.3.6",
67
67
  "puppeteer-extra-plugin-stealth": "^2.11.2",
68
68
  "queue": "^7.0.0",
@@ -76,23 +76,23 @@
76
76
  "@types/http-proxy": "^1.17.16",
77
77
  "@types/micromatch": "^4.0.9",
78
78
  "@types/mocha": "^10.0.10",
79
- "@types/node": "^22.13.4",
80
- "@types/sinon": "^17.0.3",
81
- "@typescript-eslint/eslint-plugin": "^8.24.1",
82
- "@typescript-eslint/parser": "^8.24.1",
79
+ "@types/node": "^22.13.8",
80
+ "@types/sinon": "^17.0.4",
81
+ "@typescript-eslint/eslint-plugin": "^8.25.0",
82
+ "@typescript-eslint/parser": "^8.25.0",
83
83
  "assert": "^2.0.0",
84
84
  "chai": "^5.2.0",
85
85
  "cross-env": "^7.0.3",
86
86
  "env-cmd": "^10.1.0",
87
87
  "esbuild": "^0.25.0",
88
88
  "esbuild-plugin-polyfill-node": "^0.3.0",
89
- "eslint": "^9.20.1",
89
+ "eslint": "^9.21.0",
90
90
  "extract-zip": "^2.0.1",
91
91
  "gunzip-maybe": "^1.4.2",
92
92
  "marked": "^15.0.7",
93
93
  "mocha": "^11.1.0",
94
94
  "move-file": "^3.1.0",
95
- "prettier": "^3.5.1",
95
+ "prettier": "^3.5.3",
96
96
  "sinon": "^19.0.2",
97
97
  "ts-node": "^10.9.2",
98
98
  "typescript": "^5.7.3",
@@ -157,7 +157,7 @@
157
157
  ],
158
158
  "loader": "ts-node/esm",
159
159
  "spec": "src/**/*.spec.ts",
160
- "timeout": 30000,
160
+ "timeout": 45000,
161
161
  "slow": 5000
162
162
  },
163
163
  "prettier": {
package/scripts/test.sh CHANGED
@@ -17,4 +17,4 @@ then
17
17
  fi
18
18
 
19
19
  # Run the tests
20
- ./node_modules/.bin/_mocha --timeout 30000 --slow 10000 --exit $@ && kill -TERM $xvfb
20
+ ./node_modules/.bin/_mocha --timeout 45000 --slow 10000 --exit $@ && kill -TERM $xvfb
@@ -229,17 +229,18 @@ export class BrowserManager {
229
229
  browser: BrowserInstance,
230
230
  session: BrowserlessSession,
231
231
  ) {
232
- const serverAddress = this.config.getExternalAddress();
232
+ const serverHTTPAddress = this.config.getExternalAddress();
233
+ const serverWSAddress = this.config.getExternalWebSocketAddress();
233
234
 
234
235
  const sessions = [
235
236
  {
236
237
  ...session,
237
238
  browser: browser.constructor.name,
238
239
  browserId: session.id,
239
- initialConnectURL: new URL(session.initialConnectURL, serverAddress)
240
+ initialConnectURL: new URL(session.initialConnectURL, serverHTTPAddress)
240
241
  .href,
241
242
  killURL: session.id
242
- ? makeExternalURL(serverAddress, '/kill/', session.id)
243
+ ? makeExternalURL(serverHTTPAddress, '/kill/', session.id)
243
244
  : null,
244
245
  running: browser.isRunning(),
245
246
  timeAliveMs: Date.now() - session.startedOn,
@@ -247,25 +248,48 @@ export class BrowserManager {
247
248
  },
248
249
  ];
249
250
 
250
- const wsEndpoint = browser.wsEndpoint();
251
- if (this.browserIsChrome(browser) && wsEndpoint) {
252
- const port = new URL(wsEndpoint).port;
253
- const response = await fetch(`http://127.0.0.1:${port}/json/list`, {
254
- headers: {
255
- Host: '127.0.0.1',
251
+ const internalWSEndpoint = browser.wsEndpoint();
252
+ const externalURI = new URL(serverHTTPAddress);
253
+ const externalProtocol = externalURI.protocol === 'https:' ? 'wss' : 'ws';
254
+
255
+ if (this.browserIsChrome(browser) && internalWSEndpoint) {
256
+ const browserURI = new URL(internalWSEndpoint);
257
+ const response = await fetch(
258
+ `http://127.0.0.1:${browserURI.port}/json/list`,
259
+ {
260
+ headers: {
261
+ Host: '127.0.0.1',
262
+ },
256
263
  },
257
- });
264
+ );
258
265
  if (response.ok) {
259
- const externalUrl = new URL(serverAddress);
260
- const protocol = externalUrl.protocol === 'https:' ? 'wss' : 'ws';
261
266
  const body = await response.json();
262
267
  for (const page of body) {
263
- const devtoolsFrontendUrl = `/devtools/inspector.html?${protocol}=${externalUrl.host}${externalUrl.pathname}/devtools/page/${page.id}`;
268
+ const pageURI = new URL(page.webSocketDebuggerUrl);
269
+ const devtoolsFrontendUrl =
270
+ `/devtools/inspector.html?${externalProtocol}=${externalURI.host}${externalURI.pathname}${pageURI.pathname}`.replace(
271
+ /\/\//gi,
272
+ '/',
273
+ );
274
+
275
+ // /devtools/browser/b733c56b-8543-489c-b27b-28e12d966c01
276
+ const browserWSEndpoint = new URL(
277
+ browserURI.pathname,
278
+ serverWSAddress,
279
+ ).href;
280
+
281
+ // /devtools/page/802B1FDAD5F75E9BCE92D066DFF13253
282
+ const webSocketDebuggerUrl = new URL(
283
+ pageURI.pathname,
284
+ serverWSAddress,
285
+ ).href;
286
+
264
287
  sessions.push({
265
288
  ...sessions[0],
266
289
  ...page,
267
- browserWSEndpoint: wsEndpoint,
290
+ browserWSEndpoint,
268
291
  devtoolsFrontendUrl,
292
+ webSocketDebuggerUrl,
269
293
  });
270
294
  }
271
295
  }
@@ -65,7 +65,7 @@ describe(`Limiter`, () => {
65
65
  resolve(undefined);
66
66
  });
67
67
  });
68
- }).timeout(5000);
68
+ });
69
69
 
70
70
  it('passes through arguments', () =>
71
71
  new Promise((resolve, reject) => {
@@ -47,7 +47,7 @@ describe('/kill API', function () {
47
47
  }
48
48
  expect((errorThrown1 as Error).message).contains('closed');
49
49
  expect((errorThrown2 as Error).message).contains('closed');
50
- }).timeout(45000);
50
+ });
51
51
 
52
52
  it('Kill session by browserId', async () => {
53
53
  await start();
@@ -4,10 +4,6 @@ import { NodeWebSocketTransport } from 'puppeteer-core/lib/esm/puppeteer/node/No
4
4
  import { expect } from 'chai';
5
5
 
6
6
  describe('WebSocket Page API', function () {
7
- // Server shutdown can take a few seconds
8
- // and so can these tests :/
9
- this.timeout(5000);
10
-
11
7
  let browserless: Browserless;
12
8
 
13
9
  const start = ({
@@ -47,7 +47,7 @@ describe('/kill API', function () {
47
47
  }
48
48
  expect((errorThrown1 as Error).message).contains('closed');
49
49
  expect((errorThrown2 as Error).message).contains('closed');
50
- }).timeout(45000);
50
+ });
51
51
 
52
52
  it('Kill session by browserId', async () => {
53
53
  await start();
@@ -4,10 +4,6 @@ import { NodeWebSocketTransport } from 'puppeteer-core/lib/esm/puppeteer/node/No
4
4
  import { expect } from 'chai';
5
5
 
6
6
  describe('WebSocket Page API', function () {
7
- // Server shutdown can take a few seconds
8
- // and so can these tests :/
9
- this.timeout(5000);
10
-
11
7
  let browserless: Browserless;
12
8
 
13
9
  const start = ({
@@ -13,10 +13,6 @@ import { expect } from 'chai';
13
13
  import puppeteer from 'puppeteer-core';
14
14
 
15
15
  describe('Chromium WebSocket API', function () {
16
- // Server shutdown can take a few seconds
17
- // and so can these tests :/
18
- this.timeout(5000);
19
-
20
16
  let browserless: Browserless;
21
17
 
22
18
  const start = ({
@@ -4,10 +4,6 @@ import { NodeWebSocketTransport } from 'puppeteer-core/lib/esm/puppeteer/node/No
4
4
  import { expect } from 'chai';
5
5
 
6
6
  describe('WebSocket Page API', function () {
7
- // Server shutdown can take a few seconds
8
- // and so can these tests :/
9
- this.timeout(5000);
10
-
11
7
  let browserless: Browserless;
12
8
 
13
9
  const start = ({
@@ -47,7 +47,7 @@ describe('/kill API firefox', function () {
47
47
  }
48
48
  expect((errorThrown1 as Error).message).contains('closed');
49
49
  expect((errorThrown2 as Error).message).contains('closed');
50
- }).timeout(45000);
50
+ });
51
51
 
52
52
  it('Kill session by browserId', async () => {
53
53
  await start();
@@ -47,7 +47,7 @@ describe('/kill API webkit', function () {
47
47
  }
48
48
  expect((errorThrown1 as Error).message).contains('closed');
49
49
  expect((errorThrown2 as Error).message).contains('closed');
50
- }).timeout(45000);
50
+ });
51
51
 
52
52
  it('Kill session by browserId', async () => {
53
53
  await start();
@@ -8,10 +8,6 @@ import { expect } from 'chai';
8
8
  import { webkit } from 'playwright-core';
9
9
 
10
10
  describe('Webkit Websocket API', function () {
11
- // Server shutdown can take a few seconds
12
- // and so can these tests :/
13
- this.timeout(5000);
14
-
15
11
  let browserless: Browserless;
16
12
 
17
13
  const start = ({