I have the following typical shadow dom html code:
<input is="text-input" class="input-element style-scope paper-input"
autocomplete="off" placeholder="" autocapitalize="none" autocorrect="off"
aria-describedby="" aria-labelledby="paper-input-label-22" id="input-22"
tabindex="0">
#shadow-root (user-agent)
<div id="inner-editor">test</div>
</input>
I am using Selenium to try to get the text inside the of the shadow root, but it always returns null, I know the differences between open vs closed shadow DOM, and the open version of Shadow dom always displays as #shadow-root (open) in my Devtool, so I am wondering how can I tell if this user-agent shadow dom is open or closed?
Edit: I am using JS and my code look like this:
driver.executeScript("return
arguments[0].shadowRoot",driver.findElement(webdriver.By.css("#input-
22"))).then(function(text) { text.getText()});
text come back as null.
As per @FlorentB. suggests,
driver.findElement(By.css("#input-22")).getAttribute("value")
will return the text value of the user agent shadow root.