testdriverai 4.1.49 → 4.1.50

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 (2) hide show
  1. package/lib/system.js +6 -2
  2. package/package.json +3 -3
package/lib/system.js CHANGED
@@ -2,11 +2,11 @@
2
2
  const fs = require("fs");
3
3
  const os = require("os");
4
4
  const path = require("path");
5
- const screenshot = require("screenshot-desktop");
6
5
  const si = require("systeminformation");
7
6
  const robot = require("robotjs");
8
7
  const sharp = require("sharp");
9
8
  const { emitter, events } = require("./events.js");
9
+ const { Monitor } = require("node-screenshots");
10
10
 
11
11
  let primaryDisplay = null;
12
12
 
@@ -47,7 +47,11 @@ const captureAndResize = async (scale = 1, silent = false, mouse = false) => {
47
47
  let step1 = tmpFilename();
48
48
  let step2 = tmpFilename();
49
49
 
50
- await screenshot({ filename: step1, format: "png" });
50
+ const monitors = Monitor.all();
51
+ const primaryMonitor = monitors.find(monitor => monitor.isPrimary);
52
+ const image = await primaryMonitor.captureImage(); // Capture the image asynchronously
53
+ const buffer = await image.toPng(); // Convert the image to PNG format
54
+ fs.writeFileSync(step1, buffer); // Save the image to a file
51
55
 
52
56
  // Fetch the mouse position
53
57
  const mousePos = robot.getMousePos();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.1.49",
3
+ "version": "4.1.50",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -41,13 +41,13 @@
41
41
  "robotjs": "^0.6.0",
42
42
  "sanitize-filename": "^1.6.3",
43
43
  "say": "^0.16.0",
44
- "screenshot-desktop": "^1.15.0",
45
44
  "semver": "^7.6.2",
46
45
  "sharp": "^0.33.5",
47
46
  "systeminformation": "^5.23.5",
48
47
  "tmp": "^0.2.3",
49
48
  "uuid": "^10.0.0",
50
- "winston": "^3.13.0"
49
+ "winston": "^3.13.0",
50
+ "node-screenshots": "0.2.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@eslint/js": "^9.10.0",