Shadow DOM Scraping Error

I am trying to automate a button click on a Shadow Root (open) element in salesforce. However, the Execute Javascript within TestProject is throwing an error:
Execute JavaScript “document.querySelector(”#sbPageContainer").shadowRoot.querySelector(“#content > sb-line-editor”).shadowRoot.querySelector(“#actions > sb-custom-action:nth-child(1)”).shadowRoot.querySelector(“#mainButton”).click()" with arguments “args”


javascript error: Cannot read properties of null (reading ‘shadowRoot’)

When I look at selecting the object with a select tool (selectorshub), I get a message “Alert: This element is not interactable through selenium(automation) as it is not visible in UI. Try any near by element”

All of the forums i’ve scoured say to wait until it is visible, but this is not happening (after minutes of waiting, and visually seeing the page load completely in record mode).

Has anyone run into this, have a solution or understand why this would be happening?

@justin.klatil were you able to resolve this issue? I’m running into the same problem and cannot find a solution that works.