There are some programmatic solutions for the issue to bypass the feature.
Some examples would be using Java's Robot or Autohotkey, as an another solution on top of the Chrome layer. But IMO it's not very smart. So my favorite workaround for the issue (although a little tricky) is using chrome.debugger
's Input.dispatchMouseEvent
API from Chrome Extension API.
var __target = 1857385916; // -- replace here with the tab id you desire
var x = 360 // -- replace here with your desired position to emulate click
var y = 360 // -- here as well
var button = "right"
var clickCount = 1
chrome.debugger.sendCommand({ tabId: __target }, 'Input.dispatchMouseEvent', {
type: 'mousePressed',
x: x,
y: y,
button: button,
clickCount: clickCount,
}, () => {
chrome.debugger.sendCommand({ tabId: __target }, 'Input.dispatchMouseEvent', {
type: 'mouseReleased',
x: x,
y: y,
button: button,
clickCount: clickCount,
})
});
Notes for beginners:
Create a Chrome extension with background.js created as the above script, and manifest.json created with debugger
permission enabled of course.
Chrome's menu -> "Manage Extensions" -> "Developer mode" enabled -> "load unpacked" to load the extension, as usual.
You may want to know the tab id for your desired tab to emulate a mouse event on. The following script I made might be helpful for quickly identify id of each tab.
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status === "complete" && tab.active && tab.url) {
var obj = {
tabId: tabId,
title: tab.title,
url: tab.url,
}
console.log("[(background) tab id logger]", obj, );
}
});
Add "tabs" permission to the manifest.json, reload the extension, click "background page" to open the background script inspection window, paste the above JavaScript script on the console to run the script. If you don't see any error, reload any tab, you would quickly see the tab id for the tab on the console logged.