Methods
The following methods are added to the global WebdriverIO browser
-object.
Save Methods
TIP
Only use the Save Methods when you don't want to compare screens, but only want to have an element-/screenshot.
saveElement
Saves an image of an element.
Usage
await browser.saveElement(
// element
await $('#element-selector'),
// tag
'your-reference',
// saveElementOptions
{
// ...
}
);
Support
- Desktop Browsers
- Mobile Browsers
- Mobile Hybrid Apps
- Mobile Native Apps
Parameters
element
:- Mandatory: Yes
- Type: WebdriverIO Element
tag
:- Mandatory: Yes
- Type: string
saveElementOptions
:- Mandatory: No
- Type: an object of options, see Save Options
Output:
See the Test Output page.
saveScreen
Saves an image of a viewport.
Usage
await browser.saveScreen(
// tag
'your-reference',
// saveScreenOptions
{
// ...
}
);
Support
- Desktop Browsers
- Mobile Browsers
- Mobile Hybrid Apps
- Mobile Native Apps
Parameters
tag
:- Mandatory: Yes
- Type: string
saveScreenOptions
:- Mandatory: No
- Type: an object of options, see Save Options
Output:
See the Test Output page.
saveFullPageScreen
Usage
Saves an image of the complete screen.
await browser.saveFullPageScreen(
// tag
'your-reference',
// saveFullPageScreenOptions
{
// ...
}
);
Support
- Desktop Browsers
- Mobile Browsers
Parameters
tag
:- Mandatory: Yes
- Type: string
saveFullPageScreenOptions
:- Mandatory: No
- Type: an object of options, see Save Options
Output:
See the Test Output page.
saveTabbablePage
Saves an image of the complete screen with the tabbable lines and dots.
Usage
await browser.saveTabbablePage(
// tag
'your-reference',
// saveTabbableOptions
{
// ...
}
);