Takes screenshots of parts of the viewport


This is a TDK feature

This is not supported in Testim's visual editor


Takes a screenshot of the whole screen. Returns said screenshot as a base 64 string.


Takes a screenshot of the whole page by scrolling down and taking screenshots of the different parts and stitching them together.


  • element {string | TDKStepLocator} a css selector or smart locator
// ✅ take a screenshot of the whole screen
await screenshot.viewport();
// ✅ take a screenshot of an element
await screenshot.element('.foo');
// ✅ take a screenshot of the whole page by scrolling
await screenshot.stitch();

// ❌ bad, element requires a selector
await screenshot.selector();

Full code example

'use strict';

const chai = require('chai');
const {expect} = chai;

const {go, screenshot, test, resize} = require('testim');

test("screenshot", async () => {
    await go("");

    const fullScreenImage = await screenshot.viewport();
    // fullScreenImage is a base 64 data url of the screen
    const elementImage = await screenshot.element("#element");
    const stitchedImage = await screenshot.stitch();