saveScreenshot
Save a screenshot of the current browsing context to a PNG file on your OS. Be aware that some browser drivers take screenshots of the whole document (e.g. Geckodriver with Firefox) and others only of the current viewport (e.g. Chromedriver with Chrome).
Usage
browser.saveScreenshot(filepath)
Parameters
| Name | Type | Details | 
|---|---|---|
| filepath | String | path to the generated image ( .pngsuffix is required) relative to the execution directory | 
Example
- Asynchronous Mode
- Synchronous Mode
saveScreenshot.js
it('should save a screenshot of the browser view', async () => {
    await browser.saveScreenshot('./some/path/screenshot.png');
});
saveScreenshot.js
it('should save a screenshot of the browser view', () => {
    browser.saveScreenshot('./some/path/screenshot.png');
});
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.