-
-
Save perpetual-hydrofoil/061cbeca69c885c3634d to your computer and use it in GitHub Desktop.
This file contains 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
// Don't forget to run the shell | |
// google-chrome --remote-debugging-port=9222 | |
var url = 'http://localhost:9000/'; | |
function startswith(str, prefix) { | |
return str.substring(0, prefix.length) === prefix; | |
} | |
var Chrome = require('chrome-remote-interface'); | |
Chrome({ | |
chooseTab: function(tabs) { | |
for(var i=0, c=tabs.length; i<c; i++) { | |
if (startswith(tabs[i].url, url)) { | |
return i; | |
} | |
} | |
return 0; | |
} | |
}, | |
function(chrome) { | |
chrome.Page.reload(); | |
chrome.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment