问题描述
I have an app structure like this:
<shell>
#shadow-root (open)
<mini-app>
#shadow-root (open)
<input id="username" autocomplete="off" name="username" type="text" aria-required="true" required="" value="">
</mini-app>
<shell>
nested tags with shadow-root element username inside it.I want to access input element username using webdriverio.
我可以使用以下命令访问开发人员中的用户名:
let a = document.querySelector('shell')
let b = a.shadowRoot.querySelector('mini-app')
b.shadowRoot.getElementById('username')
How can i access the same using webdriverio ? I went through this `https://webdriver.io/blog/2019/02/22/shadow-dom-support.html` but the documentation looks outdated because I am unable to use shadowRoot with shadow$
Any help would be appreciated.
还有其他方法可以通过webdriver访问shadow dom元素吗?
解决方法
文档似乎还不错,您能证明您使用shadow $方法的确切程度吗?
我相信这么简单
$('shell').shadow$('.mini-app').shadow$('#username')
应该工作