This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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
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.
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".
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.