Testim Documentation

Welcome to the Testim documentation. You'll find comprehensive guides to help you get started quickly, example code snippets, and tips for being more productive. You will also find details about advanced features that allow you to customize Testim to fit your environment or special testing conditions. Don't worry, we'll support you if you get stuck. Let's jump right in!

Guides    Changelog



This is a TDK feature

This is not supported in Testim's visual editor

This method is used to extract an element's text content.

  • selector {string | TDKStepLocator} a CSS selector or smart locator for the element whose text we want to get
  • returns: Promise which fulfills with the element's text.
// ✅ get the text of the first h1 header
const header = await text('h1');
// use Chai or another library to write assertions
expect(header).to.equal('Space & Beyond'); 
// ❌ you need to pass an element to `text`
const header = await text();

Full usage example

'use strict';

const expect = require('chai').expect;
const { go, click, test, text } = require('testim');

test("text", async () => {
    await go('http://jsbin.testim.io/quh/1');
    await click('button');
    const elementText = await text('body');
    expect(elementText).to.equal('Hello World');
    // hello

Updated about a year ago


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.