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

radio(selector)

This method is used to check if a radio element is checked or not.

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

// ✅ same with locator
const isChecked = await radio(l('input[type=radio]'));
expect(isChecked).to.equal(true); // for example with an assertion library

// ❌ need to check the return value and perform an assertion
await checkbox('.signed-up');

Full Example:

'use strict';

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

test("radio button", async () => {
    await go'use strict';('http://jsbin.testim.io/zur/');
    await click('#first')
    let firstChecked = await radio('#first');
    expect(firstChecked).to.equal(true);
    let secondChecked = await radio('#second');
    expect(secondChecked).to.equal(false);
    await click('#second')
    firstChecked = await radio('#first');
    expect(firstChecked).to.equal(false);
    secondChecked = await radio('#second');
    expect(secondChecked).to.equal(true);
});

Updated 26 days ago

radio(selector)


Suggested Edits are limited on API Reference Pages

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