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

hover(selector [, options])

Hovers over the given element on the screen, on the element center by default.

  • selector {string | TDKStepLocator} a CSS selector or smart locator.
  • options {object} optional extra arguments
    • offset {object}:
      • x {number} x position in element to hover in
      • y {number} y position in element to hover in
  • returns: Promise which fulfills when the element matching selector has been hovered over.

For example:

// ✅ hover on the first H1 in the page
await hover('h1');
// ✅ hover on the first H1 in the page in the given offset
await hover('h1', { offset: { x: 30, y: 30 }});

// ❌ you need to tell it what element to hover on
await hover({ offset: { x: 30, y: 30 } });
// ❌ hovering outside the viewport - is not useful 
await hover('h1', { offset: 15000 });

Full page example:

'use strict';

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

test("hover", async () => {
    await go('http://jsbin.testim.io/luq/1');
    await hover('#moshe');
});

Updated 26 days ago

hover(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.