Last active
February 10, 2020 07:50
-
-
Save waterplea/066197d5f5978fc9e64d3c1b74fd9c47 to your computer and use it in GitHub Desktop.
Pupeteer like browser control over devtools protocol in basic Karma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('http://localhost:9222/json') | |
.then(response => response.json()) | |
.then(([response]) => { | |
const socket = new WebSocket(response.webSocketDebuggerUrl); | |
socket.onopen = () => { | |
socket.send( | |
JSON.stringify({ | |
id: 1, | |
method: 'Browser.grantPermissions', | |
params: { | |
origin: 'http://localhost:9876', | |
permissions: ['midi', 'midiSysex'], | |
}, | |
}), | |
); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment