DOM haggling with open shadowroots in the way fails mmiserably

Hey, I hope someone can give me a few hints or something :slight_smile:

I am using gmx as mailprovider (no, no big gmail fanboy here).
doing emails directly in the website after login.
all great and all but I am deerly missing a “add to blacklist” button.
cause, yo know, my spam folder is filling with all sorts of garbage, likely often the same people senting it.
so having their emailadress on the blacklist and therefor never getting any email from them anymore would be great.
but gmx makesit complicated:
get the emailadress directly from the email, copy and paste, click through 3-5 points in the settings, put that adress into a form field and click “add to blacklist”.

clicking all the way back to the emails and rinse and repeat.

tediuos right?
would love to have a function to do this automatically.

not sure if this can be done using javascript, a tampemronkey script or via a firefox extension.

I tried some direct javascript code in the consoel directly with which , when the email is open, I simply want that one button pressed that shows the email then and retrieve said emailadress string.

which is a huge pain cause their are like 2-3 shadowroots in the path from document to the element.
someitmes I have a code that seems to work as it gives me the email string I want.
but after 2-3 tries, it might suddenly no longer work.
even though I am haggling alonmg the same dom elements down the path and the dom hasnt changed to before (the literal same dom elements and same attributes!) the querySelectors suddenly return null despite the element obviously being there!

so yeah, unrealiable as f and I dont even know why!
and yeah, the shadowroots are all open.
in general i first need to walk to the element which the shadowroot is attached to, the .shadowRoot and assign that to a variable.
on that varibsl I can do then all the queryselectors and such tosearch inside that shadowroot then…

I dont know, it jsut aint working. is the site somehow throwing bricks in my way that I jsut dont relaize or something?

any hint or help or anything would be hihly apprecciated :slight_smile:

my current tries for code look about like this:
(if code tags exist here, please tell me where to find them)

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));

async function main(){

  var shadow1=document.querySelector("webmailer-mail-list").shadowRoot;
  var shadow2=shadow1.firstChild.nextSibling.shadowRoot;
  var keyup=shadow2.querySelector("button.list-toolbar__navigation-prev");
  var keydown=keyup.nextSibling;

  var shadowa=document.querySelector("
  var shadowb=shadowa.querySelector("div#mail-head").querySelector("dl.mail-    
  document.querySelector("div#flyoutTopLevel div.content strong").innerHTML;
  var emailadress=document.querySelector("div#flyoutTopLevel div.content