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 check if a checkbox element is checked or not.

  • selector {string | TDKStepLocator} a CSS selector or smart locator.
  • returns: Promise that fulfills with whether or not this checkbox is checked
// ✅ check that a given checkbox is checked 😅
const isChecked = await checkbox('input[type=checkbox]');
expect(isChecked).to.equal(true); // for example with an assertion library

// ✅ same as above with a locator
const isChecked = await checkbox(l('.signed-up'));
expect(isChecked).to.equal(true); // for example with an assertion library

// ❌ no one checks the return value, not an assertion
await checkbox(l('.signed-up'));

// ❌ you have to pass a selector or locator
const checked = await checkbox();

Full Example

'use strict';

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

test("checkboxes", async () => {
    await go('http://jsbin.testim.io/vur/');

    await click('input[type=checkbox]')
    let isChecked = await checkbox('input[type=checkbox]');

    await click('input[type=checkbox]')
    isChecked = await checkbox('input[type=checkbox]');

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.