You can send arbitrary commands over the protocol fairly easily.
Main.sendOverProtocol('Emulation.setDeviceMetricsOverride', nexus5XMetrics());
Main.sendOverProtocol("Emulation.clearDeviceMetricsOverride");
// It returns a promise
var Chrome = require('chrome-remote-interface') | |
Chrome({ | |
chooseTab: function(tabs) { | |
var idx = 0 | |
tabs.forEach(function(tab, i) { | |
if (tab.url === 'http://localhost:9966/') | |
idx = i | |
}) | |
return idx |
<html> | |
<head> | |
<script src="modifyme.js"></script> | |
</head> | |
<body> | |
<h1>Testing source map reloading.</h1> | |
<h3>Open Dev Tools and look in the console.</h3> | |
<p>Execute the <code>test_sm()</code> function and follow the source links.</p> | |
</body> | |
</html> |
<head> | |
... | |
<meta name="viewport" content="width=device-width"> | |
... | |
</head> |