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 selects a given <option> element from an HTML <select> element.

  • selector {string | TDKStepLocator} a CSS selector or smart locator for the option element
  • returns: Promise that fulfills when the action is complete.

For example:

// ✅ select the given <option> with class option3
await selectOption('.option3');
// ✅ set an element's option by a smart locator
await selectOption(l('best-option'));
// ❌ need to pass the option and not the select
await selectOption('select');

Full Example:

'use strict';

const expect = require('chai').expect;
const { go, it, describe, selectOption, evaluate } = require('testim');

describe('selectOption', () => {
    it('selects correctly', async () => {

        await go('http://jsbin.testim.io/yut/');
        await selectOption('option:nth-child(3)');

        const value = await evaluate(() => {
            return document.querySelector('select').value;

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.