Skip to main content

Update October 2022: As per Remote debug Android devices, the chrome://inspect/#devices page has replaced the Remote devices debugger panel, breaking the JS in this answer and similar ones.


Just joined this StackExchange to show some appreciation for Jeremy's answer above, and also add the few lines of JS I used to export the tabs list (since copying with the cursor isn't ideal!)

Just joined this StackExchange to show some appreciation for Jeremy's answer above, and also add the few lines of JS I used to export the tabs list (since copying with the cursor isn't ideal!)

Update October 2022: As per Remote debug Android devices, the chrome://inspect/#devices page has replaced the Remote devices debugger panel, breaking the JS in this answer and similar ones.


Just joined this StackExchange to show some appreciation for Jeremy's answer above, and also add the few lines of JS I used to export the tabs list (since copying with the cursor isn't ideal!)

  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Command+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
    • N.B. /deep/ is the CSS selector to enter #shadow-root DOM elements
tabslet bookmarkList = Array.from(document.querySelectorAll('div'.widget>.vbox'))
 /deep/ div.map(e /deep/=> dive.shadowRoot)
 /deep/ div.map(e /deep/=> dive /deep/&& e.querySelector('.device-page-listlist'))
  .vbox'find(e => e),;

let sbookmarks =>= Array.from({name: sbookmarkList.querySelectorquerySelectorAll('.device-page-title'vbox'))
  .textContent,map(e url:=> s`[${e.querySelector('.device-page-url title').devtoolsinnerHTML}](${e.querySelector('x-link').hrefinnerHTML})`);
str = '';
for copy(i=0;i<tabsbookmarks.length;i++){
  str += '['+tabs[i]['name']+']join('+tabs[i]['url']+''\n')\n'
}
copy(str);
[How can I export the list of open Chrome tabs? - Android Enthusiasts Stack Exchange](https://android.stackexchange.com/questions/56635/how-can-i-export-the-list-of-open-chrome-tabs)
[Get Started with Remote Debugging Android Devices  |  Tools for Web Developers  |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
[How To Enable USB Debugging On Your Android Phone](https://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/)
[Configure On-Device Developer Options | Android Studio](https://developer.android.com/studio/debug/dev-options.html)
...

Update

For some reason I'm getting an error some of the time, saying it failed to get the href attribute of a null item (when I inspect it it's an invisible node, who knows). To step around this, use this version instead:

tabs = document.querySelectorAll('div /deep/ div /deep/ div /deep/ div /deep/ div /deep/ .device-page-list .vbox')
str = '';
for (i=0;i<tabs.length;i++){
  if (tabs[i].querySelector('.device-page-url .devtools-link') != null){
    str += '- ['+tabs[i].querySelector('.device-page-title').textContent + '](' + tabs[i].querySelector('.device-page-url .devtools-link').getAttribute('href') +')\n'
  } else {
    console.log(tabs[i])
  }
}
copy(str)
  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Command+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
    • N.B. /deep/ is the CSS selector to enter #shadow-root DOM elements
tabs = Array.from(document.querySelectorAll('div /deep/ div /deep/ div /deep/ div /deep/ div /deep/ .device-page-list .vbox'), s => ({name: s.querySelector('.device-page-title').textContent, url: s.querySelector('.device-page-url .devtools-link').href}))
str = '';
for (i=0;i<tabs.length;i++){
  str += '['+tabs[i]['name']+']('+tabs[i]['url']+')\n'
}
copy(str)
[How can I export the list of open Chrome tabs? - Android Enthusiasts Stack Exchange](https://android.stackexchange.com/questions/56635/how-can-i-export-the-list-of-open-chrome-tabs)
[Get Started with Remote Debugging Android Devices  |  Tools for Web Developers  |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
[How To Enable USB Debugging On Your Android Phone](https://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/)
[Configure On-Device Developer Options | Android Studio](https://developer.android.com/studio/debug/dev-options.html)
...

Update

For some reason I'm getting an error some of the time, saying it failed to get the href attribute of a null item (when I inspect it it's an invisible node, who knows). To step around this, use this version instead:

tabs = document.querySelectorAll('div /deep/ div /deep/ div /deep/ div /deep/ div /deep/ .device-page-list .vbox')
str = '';
for (i=0;i<tabs.length;i++){
  if (tabs[i].querySelector('.device-page-url .devtools-link') != null){
    str += '- ['+tabs[i].querySelector('.device-page-title').textContent + '](' + tabs[i].querySelector('.device-page-url .devtools-link').getAttribute('href') +')\n'
  } else {
    console.log(tabs[i])
  }
}
copy(str)
  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Command+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
let bookmarkList = Array.from(document.querySelectorAll('.widget>.vbox'))
  .map(e => e.shadowRoot)
  .map(e => e && e.querySelector('.device-page-list'))
  .find(e => e);

let bookmarks = Array.from(bookmarkList.querySelectorAll('.vbox'))
  .map(e => `[${e.querySelector('.device-page-title').innerHTML}](${e.querySelector('x-link').innerHTML})`);

copy(bookmarks.join('\n'));
[How can I export the list of open Chrome tabs? - Android Enthusiasts Stack Exchange](https://android.stackexchange.com/questions/56635/how-can-i-export-the-list-of-open-chrome-tabs)
[Get Started with Remote Debugging Android Devices  |  Tools for Web Developers  |  Google Developers](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
[How To Enable USB Debugging On Your Android Phone](https://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/)
[Configure On-Device Developer Options | Android Studio](https://developer.android.com/studio/debug/dev-options.html)
...
  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Ctrl+JCommand+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
    • N.B. /deep/ is the CSS selector to enter #shadow-root DOM elements
  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Ctrl+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
    • N.B. /deep/ is the CSS selector to enter #shadow-root DOM elements
  • open a 2nd devtools view on the devtools view from which you selected Remote devices to be able to retrieve the list of tabs using JavaScript
    • note that you must have devtools in pop-out mode (use the vertical ellipsis symbol in the top right of the panel) to be able to get this up, otherwise Command+Option+J(MAC) Ctrl+Shift+J(WINDOWS) will just close the first devtools panel.
  • expand the list from the first few items to all tabs by clicking 'Show more'
  • to script against the list, use the following few lines of code [entered in the console of the 2nd devtools window]
    • N.B. /deep/ is the CSS selector to enter #shadow-root DOM elements
Adding steps for windows user, took me some time to get this part. Hopefully it helps others.
Source Link
Loading
It no longer (Chrome 65) works to obtain URL via `href` property (returns `undefined`), but it is available but `getAttribute('href')`. This may result from the fact that the `.devtools-link` element is now `x-link`. Using the `._href` property also works but seems hacky.
Source Link
Loading
Minor edit
Source Link
Loading
added 80 characters in body
Source Link
Loading
Source Link
Loading