Reputation: 452
Can i simulate event submit/click on page elements uses chrome plugin? If plugin mode on. Plugin looking some elements on page and send click event.
Upvotes: 1
Views: 514
Reputation: 8472
Yes, you can do this by creating a custom event from a content script. Try something like this:
function simulateClick(elementId) {
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, false, document, 0, 0, 0, 0, 0, false,
false, false, false, 0, null);
document.getElementById(elementId).dispatchEvent(evt);
}
See dispatchEvent docs on MDN for more info.
Upvotes: 2