screenshot
Save the screen as a PNG file.
js
screenshot(pathOrOptions?)Arguments
| Argument | Type | Meaning |
|---|---|---|
pathOrOptions | string | object | Optional absolute path or {savePath}; omitted overwrites the default screenshot. |
Returns
Saved path string, or null on failure.
Example
js
const path = screenshot(__dirname + "/capture.png");
if (!path) throw new Error("Capture failed");
console.log(path);