Skip to content

Instantly share code, notes, and snippets.

@garethrees
Last active November 6, 2023 13:07
Show Gist options
  • Save garethrees/4dc1e78b38de2f8edbb857c4400c740e to your computer and use it in GitHub Desktop.
Save garethrees/4dc1e78b38de2f8edbb857c4400c740e to your computer and use it in GitHub Desktop.
Print all Gmail labels
// Go to the Inbox
// Unfold label menus (only labels visible to you will be collected)
// Open a console
var elementsWithDataLabel = document.querySelectorAll('[data-label-name]');
var dataLabelValues = Array.from(elementsWithDataLabel).map(el => el.getAttribute('data-label-name'));
dataLabelValues.forEach(value => {
console.log(value);
});
// Go to Settings -> Labels
// Open a console
let list = document.querySelectorAll(".alC");
let items = Array.from(list).map(elem => {
console.log(elem.innerText);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment