Answers for ""chrome.debugger.sendcommand" "Input.dispatchKeyEvent" example"

0

"chrome.debugger.sendcommand" "Input.dispatchKeyEvent" example

chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
    if(message.pressEnter){
        chrome.tabs.query({active: true}, function(tabs) {
            chrome.debugger.attach({ tabId: tabs[0].id }, "1.0");
            chrome.debugger.sendCommand({ tabId: tabs[0].id }, 'Input.dispatchKeyEvent', { type: 'keyUp', windowsVirtualKeyCode:13, nativeVirtualKeyCode : 13, macCharCode: 13  });
            chrome.debugger.sendCommand({ tabId: tabs[0].id }, 'Input.dispatchKeyEvent', { type: 'keyDown', windowsVirtualKeyCode:13, nativeVirtualKeyCode : 13, macCharCode: 13  });
            chrome.debugger.detach({ tabId: tabs[0].id });
        });
    }
});
Posted by: Guest on October-14-2020

Code answers related to ""chrome.debugger.sendcommand" "Input.dispatchKeyEvent" example"

Code answers related to "Javascript"

Browse Popular Code Answers by Language