I am working on writing a script on browser web pages. I need to trigger right click event or a long press event on an HTML element.
I have figured out how to click on an element through the click() method. But now i need to trigger a right click or a long press.
Here is the code:
let div = document.querySelector(".scrollViewport");
let chats = div.children[0].children[0].children;
chats[index].children[0].children[0].click();
Any help? Thanks,