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

All of the APIs here run on the main tab, in order to run an API on another tab we expose a withContext function that will return an object with all the above set to a specific tab/frame.

  • frameSelector {string| string[]} - a CSS selector for selecting an iframe to run the code in. (default on main frame). An array of strings is passed in case of a nested iframe.
  • tabUrl {string} - A glob pattern to select which tab to run the step on by URL. (default on main tab)
  • tabIndex {number} - A tab index (starting with 0) to run the step on. (default on main tab)
  • returns: the same API as the rest of Codim except bound to a specific frame or tab.

For example:

const { click } = withContext({
 frameSelector: '.iframe',
 tabUrl: '*app.testim.io* 

Full Example:

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

describe("scrollToElement", () => {

  test('iframes', async () => {
      await go('http://jsbin.testim.io/mux');
      const { text } = withContext({
          frameSelector: 'iframe'
      const iframeText = await text('body');
      expect(iframeText).to.contain('Hello World');

  test('multi-tab with nested iframes', async () => {
      await goto('http://jsbin.testim.io/noy');
      await click('a#navigate');
      const secondOutput = withContext({
          frameSelector: ['iframe', 'iframe[sandbox]'],
          tabUrl: 'http://jsbin.testim.io/biv/edit?html,output'
      const openedTabText = await secondOutput.text('body');
      expect(openedTabText).to.contain('Hello World');

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.