Last active
August 29, 2023 07:03
-
-
Save Kipjr/f216ef6cfb3dce044102a6c983eb7acc to your computer and use it in GitHub Desktop.
getAndroidChromeTabs.js
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
// go to 'chrome://inspect/#devices' | |
// press F12 and paste this in console | |
var tabs = confirm("Open all in tabs?") | |
var urlonly = confirm("URLS only?") | |
var serials = [...document.getElementsByClassName("device-serial")]; | |
var mapping = [];serials.forEach((e,i) => { | |
mapping[i]=confirm(e.textContent) | |
}) | |
var ser = serials.filter((e,i)=> { | |
if (mapping[i]===true){ | |
return e | |
} | |
}) | |
var ser = ser[0].childNodes[0].data | |
console.log(ser); | |
var arr = [...document.getElementById(ser.replace("#",'')+":chrome_devtools_remote").querySelector("div.list.pages").getElementsByClassName("subrow")] | |
var string = ""; | |
for (var i=0; i < arr.length;i++){ | |
if(urlonly){ | |
console.log(arr[i].childNodes[1].childNodes[0].data) | |
} else { | |
string += (i+';"'+arr[i].childNodes[0].childNodes[0].wholeText+'"'+";"+arr[i].childNodes[1].childNodes[0].data)+"\n" | |
} | |
if(tabs){ | |
window.open(arr[i].childNodes[1].childNodes[0].data) | |
} | |
} | |
console.log(string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment