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

waitForNoElement(selector [,options])

🚧

This is a TDK feature

This is not supported in Testim's visual editor

Waits for an element to no longer exist on the screen.

  • selector {string | TDKStepLocator} a CSS selector or smart locator.
  • options {object}
    • checkVisibility { boolean } whether or not to wait for the element to no longer be user visible rather then exist on the page - defaults to true.
  • returns: Promise that fulfills when the element is present.

For example:

// ✅ good, wait for the element
await waitForNoElement('.someSelector');
// ✅ good, wait for the element to be on the page but not for visibility
await waitForNoElement('.someSelector', {
  checkVisibility: false
});
// ✅ good, wait for the element by locator
await waitForNoElement(l('login-form'));

// ❌ need to pass an element in
await waitForNoElement();
// ❌ options is the second argument
await waitForNoElement({
  selector: '.foo',
  checkVisibility: true
});

Full Example

'use strict';

const { go, waitForNoElement, evaluate, test } = require('testim');

test("waitForNoElement", async () => {
    await go('http://jsbin.testim.io/tiq/1');
    await evaluate(() => setTimeout(function () {
        var divs = [].slice.call(document.querySelectorAll('div'));
        divs.forEach(function(div) {
            div.parentNode.removeChild(div);
        });
    }, 10));
    await waitForNoElement('div');
});

Updated 3 months ago

waitForNoElement(selector [,options])


Suggested Edits are limited on API Reference Pages

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