Finding elements in the shadow DOM

前端 未结 2 1795
甜味超标
甜味超标 2021-02-04 14:39

Protractor 1.7.0 has introduced a new feature: a new locator by.deepCss which helps to find elements within a shadow DOM.

Which use cases does it cover? When would you w

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 15:06

    The reason I ask the question is that I'm missing on the motivational part of the matter - I thought about protractor mainly as a high-level framework that helps to mimic real user interactions. Accessing shadow trees sounds like a very deep down technical thing and why would you want to do it is confusing me.

    Doesn't seem so in this website that shows an introduction to shadow DOM. It says that:

    Shadow DOM separates content from presentation thereby eliminating naming conflicts and improving code expression.

    Shadow DOM mainly helps with separating content to avoid naming conflicts and improving your code expression, making it neater and better (I assume). I am sorry to say that I don't actually use Selenium, so here is a website with plenty more information: http://webcomponents.org/polyfills/shadow-dom/

    I hope this helps you!

提交回复
热议问题