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!)
As Jeremy said, select Remote devices
under More tools
on Chrome devtools ⋮
icon (top right of the panel):
- set up USB debugging on your phone (under
Settings
⇒Developer options
, root not required)- note that you must enable the
Developer options
menu, it's hidden by default to protect users - on my phone this required tapping multiple times on the build number under
Settings
⇒About Device
- note that you must enable the
- once this is done, plug your USB in and allow MTP connection
- when the Chrome devtools remote device panel is open, the phone will then request to allow USB debugging
- you can opt to always trust the computer
Now the device is connected,
- 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.
- 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)
- 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]
To export a list of all URLs open on Chrome for Android, I chose to just make the list into a markdown formatted text string and copy it to the clipboard
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'));
You will then have a list on your clipboard looking like this:
[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)
...