Right Click

Right-clicks a webpage element.

t.rightClick( selector [, options] )
Parameter Type Description
selector Function | String | Selector | Snapshot | Promise Identifies the webpage element being right-clicked. See Selecting Target Elements.
options (optional) Object A set of options that provide additional parameters for the action. See Click Action Options.

The following example shows how to use the t.rightClick action to invoke a grid's popup menu.

import { Selector } from 'testcafe';

fixture `My fixture`
    .page `http://www.example.com/`;

test('Popup Menu', async t => {
    await t
        .rightClick('#cell-1-1')
        .expect(Selector('#cell-popup-menu').exists).notOk();
});

The t.rightClick action will not invoke integrated browser context menus, native editor menus, etc. Use it to perform right clicks that are processed by webpage elements, not the browser.