nightwatchjs saveScreenshot giving TypeError: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView
Asked 07 September, 2021
Viewed 1.8K times
  • 64
Votes

I am working on an automation prototype using Nightwatch js and when I am trying to save screenshot, it is giving below error


Error while running .getScreenshot() protocol action: An unknown server-side error occurred while processing the command. – An unknown server-side error occurred while proces...


TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (10.032s)

TypeError: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object at Object.writeFile (fs.js:1487:5) at FSReqCallback.oncomplete (fs.js:180:23)

FAILED: 1 errors and 1 passed (9.662s)

relevant data for nightwatch.config.js:

 test_settings: {
        "screenshots": {
            "enabled": true, // if you want to keep screenshots
            "path": './screenshots' // save screenshots here
          },

test file data:

.pause(3000).saveScreenshot('./screnshots/test.png');

Nightwatch version: "1.5.1"

please note that due to office policy cannot paste complete testcase data here.

enter image description here

0 Answer