0

我正在尝试将鼠标事件发送到我的屏幕外选项卡,但收到以下错误:

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

我的代码:

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

有什么建议么?

4

1 回答 1

1

button如果您使用鼠标事件,您还需要添加一个键。

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

由于 API 是实验性的,而且文档还不是很完整,所以我查看了源代码:

PS。当我使用button: 2. 对于调试与屏幕外选项卡的交互非常有用!

于 2012-12-03T19:15:14.960 回答