I have a workspace in which I can add different objects. There is a scenario in which on double click, an object can be automatically added in the workspace. I have gone through different solutions but none of them really worked.
This is what I have tried:
await page.evaluate(selector => {
var targLink = document.querySelector(selector);
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initEvent('dblclick', true, true);
targLink.dispatchEvent(clickEvent);
}, selector)
You can use
mouse.click(x, y[, options])
.First get
x
andy
.Then pass
clickCount
as an option to simulate double click.Full code:
Update
You can add delay between the two clicks by use
delay
option. The code below will click double clicks to element with 100ms delay.