0

I am trying to send Mouse Event to my Offscreen Tab and I received following error:

Error during experimental.offscreenTabs.sendMouseEvent:
 Invalid or unexpected MouseEvent object

My Code:

chrome.experimental.offscreenTabs.sendMouseEvent(tab.id, {
    "type": "click",
    "altKey": false,
    "ctrlKey": false,
    "shiftKey": false
}, {
    "x": 10,
    "y": 10
}, function () {
    console.log("Mouse Event Sent");
});

Any Suggestions?

Rob W
  • 341,306
  • 83
  • 791
  • 678
Sudarshan
  • 18,140
  • 7
  • 53
  • 61

1 Answers1

1

You need to add a button key as well if you use a mouse event.

{
    "type": "click",
    "button": 1,      // 0 = left, 1 = middle, 2 = right
    "altKey": false,
    "ctrlKey": false,
    "shiftKey": false
}

Since the API is experimental, and the documentation is not quite complete, I looked in the source code:

PS. I managed to get a Developer tools instance when I used button: 2. Quite useful for debugging interaction with an offscreen tab!

Rob W
  • 341,306
  • 83
  • 791
  • 678
  • Thanks it solved, BTW how did you get developers tools instance to a offscreen tab ? :) did you use Debugger API()'s ? – Sudarshan Dec 04 '12 at 03:24
  • @Sudarshan No, button=2 opens a contextmenu here (Chrome 23 / ArchLinux). There, I choose "Inspect element". – Rob W Dec 04 '12 at 13:17
  • I took a complete different meaning for `I managed to get a Developer tools instance when I used button: 2. Quite useful for debugging interaction with an offscreen tab!` :), my bad.. i got it .. thanks :) – Sudarshan Dec 04 '12 at 13:25