w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Clarify if Document (and other non-Element Nodes) are allowed as startNodes of browsingContext.locateNodes #703

Closed juliandescottes closed 3 weeks ago

juliandescottes commented 2 months ago

In the current spec for browsingContext.locateNodes, it is not clear if we can pass only Element in the startNodes parameter or if non-Elements (eg Document) are allowed.

For the accessibility and innerText locators, the spec calls other specs which only work with Elements:

Should we restrict startNodes to only contain Elements? Or should we add a special case if a Document is provided to use its document element?

juliandescottes commented 2 months ago

See #702

OrKoN commented 2 months ago

Shadow roots are also non-element nodes so I think the locator API is meant to accept Node's in general. We should probably make sure a11y and innerPath algorithms check the node type before performing element specific steps.

juliandescottes commented 3 weeks ago

All locators have now been updated to handle non-element context nodes correctly. Either they support it by definition (css, xpath), or logic has been added to handle them.