I'm trying to count the number of mails in outlook (and i works), but for the unreaded messages i'm looking for the aria-label where i could find "No leído"(unread), i tried using this array method and then return his lenght, but i doesn't work, any suggestions?
function getMailElementsByClass(document_root) {
var elements = document_root.getElementsByClassName("_1xP-XmXM1GGHpRKCCeOKjP");
var mailsRead = 0;
var unRead = [];
for(var i=0; i<elements.length; i++) {
console.log(elements[i]);
mailsRead++;
}
Array.from(elements).forEach(v => v.getAttribute('aria-label').startsWith('No Leído') ? unRead.push(v) : v);
return mailsRead + ' Mails registrados! \nMails no leídos: ' + unRead.length;
}