This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22987 - Proposal: Shadow DOM support in WebDriver
Summary: Proposal: Shadow DOM support in WebDriver
Status: NEW
Alias: None
Product: Browser Test/Tools WG
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Browser Testing and Tools WG
QA Contact: Browser Testing and Tools WG
URL: https://docs.google.com/document/d/1q...
Whiteboard:
Keywords:
Depends on:
Blocks: 24121
  Show dependency treegraph
 
Reported: 2013-08-16 23:06 UTC by Marc Fisher
Modified: 2018-06-21 11:07 UTC (History)
6 users (show)

See Also:


Attachments
Patch for Shadow Dom and WebEelement lifetime (4.35 KB, patch)
2013-09-23 22:42 UTC, chrisgao
Details
Patch for Shadow Dom and WebEelement/ShadowRoot lifetime(v2) (4.54 KB, patch)
2013-12-14 21:38 UTC, chrisgao
Details

Description Marc Fisher 2013-08-16 23:06:53 UTC
The current proposal for dealing with Web Components and their corresponding Shadow DOMs in WebDriver treats them similarly to frames; at any point in time the WebDriver session is operating within a particular DOM, either the top-level DOM or one of the Shadow DOMs of a particular Web Component. However, this makes interacting with pages that use Web Components extremely taxing, as the current DOM will have to be switched on a regular basis, and it is unclear over what time frame an element id found within a particular DOM will be considered valid. Instead I propose that the WebDriver wire protocol be extended with commands to get the list of attached Shadow DOMs for an elements as opaques IDs and to support new element and elements commands that are scoped to a particular DOM.  Additionally, element IDs from Shadow DOMs be completely accessible as long they are the corresponding element attached to the Shadow DOM and the Shadow DOM is attached to the page.

For a more thorough description see:
https://docs.google.com/document/d/1qP7Se3MDUac5P0V1Kfm2yaj3fFhBOFCyWyXLcsVwkTA/edit?usp=sharing
Comment 1 chrisgao 2013-09-23 22:42:57 UTC
Created attachment 1400 [details]
Patch for Shadow Dom and WebEelement lifetime

Do we want to make it explicit in spec which commands are supported with Shadow DOM roots?
eg.: FindElement, FindElements, ExecuteScript, ExecuteAsyncScript, GetActiveElement and the like.
Comment 2 Marc Fisher 2013-10-17 22:19:20 UTC
Of the current commands that take a WebElement:

findElement and findElements: Search scoped to the Shadow DOM.

execute[Async]Script: if a Shadow DOM root is passed as parameter it should be resolved to the correct ShadowRoot instance (http://www.w3.org/TR/shadow-dom/#shadow-root-object).

Any other command that takes an element id (e.g. isSelected, getElementAttribute, getText) should throw an exception if passed a Shadow DOM root. None of the current set of status codes seem appropriate, so maybe add a new one "operation not supported on shadow dom root".

It may be reasonable to add an optional element id parameter to the following commands:

getActiveElement: returns ShadowRoot.activeElement

getSource: returns ShadowRoot.innerHTML

If added, these commands should probably throw an exception if the element id doesn't correspond to a shadow dom root: "operation only supported on shadow dom root".
Comment 3 chrisgao 2013-12-14 21:38:37 UTC
Created attachment 1420 [details]
Patch for Shadow Dom and WebEelement/ShadowRoot lifetime(v2)

Update the patch for shadow dom according to the discussion in the F2F meeting at TPAC 2013.