Skip to main content

Screenshot

caution

Since these screenshots are uploaded only after selenium script has fully exited, screenshots could be lost if test was aborted early or has failed.

client.takeScreenshot((filename: string), (exitOnFail: boolean = false));

The filename parameter specifies name of the file when it will be saved.

The exitOnFail parameter lets participant terminate test execution if there was a problem taking screenshot. This parameter can be omitted and will default to false.

client => {
// Example of taking browser screenshot
client
.url('https://www.bing.com')
.waitForElementVisible('[type=search]', 10000)
.takeScreenshot('screenshot.png');
}
danger

Screenshot creation is impossible in some cases, for example, when an alert is open. Ignore alert can be used to close an alert if it is open, this command will not impact the execution if an alert is not open.