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.

 

 

0
2 comments
Avatar
Joseph Hamdan

Hi Abayomi,

Would you please let us know why you are using JavaScript for clicking or double click? Just so we can better understand your reasons.

Thanks!

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

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

0
Comment actions Permalink

Please sign in to leave a comment.