Answered
Request for Double Click Javascript
Hello, eRA testers are using the following script for Execute JavaScript commands for Click...
arguments[0].click();
.. is there a script for Double Click commands that can be provided as well?
Also it would be great to have a list of common commands with comparable scripts, thanks.
2 comments
Sort by
Date
Votes
Hi Stephen,
Here are different snippets than can do this:
If you are using ID attribute:
let event = new MouseEvent('dblclick', { 'view': window, 'bubbles': true, 'cancelable': true }); document.getElementById('doubleClickBtn').dispatchEvent(event);
If you are using XPath:
let event = new MouseEvent('dblclick', { 'view': window, 'bubbles': true, 'cancelable': true }); document.evaluate('//button[contains(text(),"Double clicked button")]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.dispatchEvent(event);
Regards,
Subject7 Team
Please sign in to leave a comment.