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 checks that an element matching the given selector exists on the page:

  • selector {string | TDKStepLocator} a CSS selector or smart locator.
  • returns: Promise that fulfills with true if the element exists on the page or false if it doesn't.

Note: This method does not wait for the element to be available on the page like other control methods.

// ✅ checks if the given elementt is available on the page
const doesExist = await exists('.some-selector');
// ✅ assertion that an element exists on the page using `chai`
const loginPresent = await exists('.login-form');

// ✅ assertion with locators
const userExists = await exists(l('user-name');

// ❌ does not actually do anything since no one looks at the result
await exists('.some-selector');
// ❌ need to pass a selector or locator in
await exists();

Full Example

'use strict';

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

test("exists" , async () => {
    await go('http://jsbin.testim.io/quh/1');
    await waitForElement('button');
    const first = await exists('button');
    const second = await exists('my-element');

Updated 3 months ago


Suggested Edits are limited on API Reference Pages

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