I'm writing a script to test an input box embedded into multiple nested shadow DOMs with the structure below. Red boxes are the shadow DOMs (I had to cut off the first one out because it won't fit onto the screenshot) and green box is the element I want to interact with (a text box): I wrote the script below following the nested shadow DOM guidance here thinking that I need to send the type command to the final shadowRoot variable. When running it, I get a javascript error: By is not defined error. I'm weak in JS but I'm pretty sure I have the correct selenium syntax so I can't understand why it's failing to locate the shadow DOM tags. host = driver.find_element(By.TAG_NAME, "macroponent-f51912f4c700201072b211d4d8c26010") shadowRoot = driver.execute_script(f"return arguments[0].shadowRoot.findElements(By.tagName('sn-polaris-layout'))[0].shadowRoot.findElements(By.tagName,('sn-polaris-header'))[0].shadowRoot.findElements(By.t...
A site where you can share knowledge