问题
Is it possible to make particular elements act as it was clicked on them by calling another function? For example I am trying to make an extension which will automatically clicks a button once I click on the extension. Is it possible to achieve this and if so can somebody point me to the direction of how to do it?
回答1:
I think this can be done by the content script. I would add a listener to the extension icon click in the background page. After the callback is triggered, I would inject a content script into the page with UI element. And in this content script I would find a button and trigger click on it.
来源:https://stackoverflow.com/questions/39958812/chrome-extension-making-mouse-click-with-extension