Ir al Contenido Principal

saveScreenshot

Save a screenshot of an element to a PNG file on your OS.

Usage
$(selector).saveScreenshot(filename)
Parameters
NameTypeDetails
filenameStringpath to the generated image (.png suffix is required) relative to the execution directory
Example
saveScreenshot.js
it('should save a screenshot of the browser view', async () => {
const elem = await $('#someElem');
await elem.saveScreenshot('./some/path/elemScreenshot.png');
});

Welcome! How can I help?

WebdriverIO AI Copilot