dblclick(selector [,options)
This is a TDK feature
This is not supported in Testim's visual editor
Double-clicks the given element on the screen, clicks on the element center by default.
selector
{string | TDKStepLocator} a CSS selector or smart locator.options
{object} optional extra argumentsoffset
{object}:x
{number} x position in element to click iny
{number} y position in element to click in
- returns: Promise which fulfills when the element matching
selector
has been double-clicked or rejected if the element is not found.
For example:
// ✅ double click on the first h1 on the page
await dblclick('h1');
// ✅ double-click first h2 on the page with an offset
await dblclick('h2', { offset: { x: 30, y: 30 }});
// ✅ double-click on the first login page button recorded
// as a smart locator
await dblclick(l('login-button'));
// ❌ offset takes an object parameter
await dblclick('h2', { offset: 30 });
// ❌ need to pass a first parameter selector
// or smart locator to know where to double click
await dblclick();
Full Example
const { go, dblclick, test, text } = require('testim');
const expect = require('chai').expect;
test("dblclick", async () => {
await go('http://jsbin.testim.io/xik/1');
await dblclick('#mybutton');
const dblclicked = await text('#mybutton');
expect(dblclicked).to.equal('dblclicked');
});
Updated almost 3 years ago