shadow-dom

Accessing Shadow DOM tree with Selenium

匆匆过客 提交于 2019-11-27 04:38:17
Is it possible to access elements within a Shadow DOM using Selenium/Chrome webdriver? Using the normal element search methods doesn't work, as is to be expected. I've seen references to the switchToSubTree spec on w3c, but couldn't locate any actual docs, examples, etc. Anyone had success with this? Unfortunately it looks like the webdriver spec does not support this yet. My snooping uncovered : http://www.w3.org/TR/webdriver/#switching-to-hosted-shadow-doms https://groups.google.com/forum/#!msg/selenium-developers/Dad2KZsXNKo/YXH0e6eSHdAJ The accepted answer is no longer valid and some of

Composing v1 nested web components

≯℡__Kan透↙ 提交于 2019-11-27 03:29:49
问题 I'm new to webcomponents. Since v1 of webcomponents is available, I'm starting there. I have read various posts around the web about them. I'm particularly interested in composing them correctly. I have read about slots and have them working, although my efforts have not resulted in slotted webcomponents that work the way I expected. If I have compose nested web components like this, the DOM from the nested/slotted webcomponent does not get inserted in the slot of the parent: <parent

Is shadow DOM fast like Virtual DOM in React.js?

馋奶兔 提交于 2019-11-27 02:45:06
Does implementing Shadow DOM in my projects will make them faster like virtual DOM that's used by React? Günter Zöchbauer Virtual DOM Virtual DOM is about avoiding unnecessary changes to the DOM, which are expensive performance-wise, because changes to the DOM usually cause re-rendering of the page. Virtual DOM also allows to collect several changes to be applied at once, so not every single change causes a re-render, but instead re-rendering only happens once after a set of changes was applied to the DOM. Shadow DOM Shadow dom is mostly about encapsulation of the implementation. A single

Polymer share styles across elements

穿精又带淫゛_ 提交于 2019-11-27 02:12:05
I need to share styles across multiple Polymer elements. Is it acceptable to create a "styles.html" file and then import that into my different elements or would this start to have performance implications as the app grows? I know for 0.5 there was a core-styles but it kind of seems unnecessary if imports will work just as well. styles.html <style> button { background: red; } </style> my-button.html <link rel="import" href="../bower_components/polymer/polymer.html"> <link rel="import" href="../styles/main-styles.html"> <link rel="import" href="../behaviors/mixins.html"> <dom-module id="my

How to let imported css have effects on elements in the shadow dom?

耗尽温柔 提交于 2019-11-27 02:11:36
Say if I want to create a custom element using shadow dom. Some elements in the template have class names specified in the linked css file. Now I want to let the css rules have effects on the elements. But I can't achieve that because of the shadow dom style boundary. <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <template id="blog-header"> <header> <h1>DreamLine</h1> <nav> <ul> <li><a href="#0">Tour</a></li> <li><a href="#0">Blog</a></li> <li><a href="#0">Contact</a></li> <li><a href="#0">Error</a></li> <li><a href="

What's the substitute for ::shadow and /deep/?

橙三吉。 提交于 2019-11-27 02:04:19
问题 The two shadow-piercing combinators have been deprecated as stated in https://www.chromestatus.com/features/6750456638341120 Then what's the substitude for achieving the same thing, or this shadow-piercing feature has been completely abandoned? 回答1: ::shadow and /deep/ were removed for breaking encapsulation. The substitutes are: CSS variables. It already works natively with the recently launched Google Chrome 49. Read here: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/

Click event not firing when React Component in a Shadow DOM

情到浓时终转凉″ 提交于 2019-11-27 01:33:55
问题 I have a special case where I need to encapsulate a React Component with a Web Component. The setup seems very straight forward. Here is the React Code: // React Component class Box extends React.Component { handleClick() { alert("Click Works"); } render() { return ( <div style={{background:'red', margin: 10, width: 200, cursor: 'pointer'}} onClick={e => this.handleClick(e)}> {this.props.label} <br /> CLICK ME </div> ); } }; // Render React directly ReactDOM.render( <Box label="React Direct"

Can a Shadow DOM secure my elements?

陌路散爱 提交于 2019-11-27 01:08:52
问题 Goal: an encapculated widget Suppose I'm the developer of a friends widget for FakeBook™. I provide a widget for website owners that adds a personalized message like this to their pages: Your friends Michael, Anna and Shirley love this webpage! First approach: script that creates span Naively, I create a script which places this information in a span on the website. However, the owners of ExampleSite can now access the names of your friends by simple DOM operations! That's a big privacy /

How to automate shadow DOM elements using selenium?

北战南征 提交于 2019-11-26 22:12:40
问题 I am using Java Selenium project for web page automation. The web page contains lots of multi-level shadow-root DOM elements that I am not able to interact with using selenium findElement method. I have tried the following solutions: deep css (Don't work on latest chrome browser) JS Executor. (This is really tedious and becomes complex to maintain) Note: If you know any other solution other than listed above that I can implement in Selenium Java framework , please pass on the solution. Thanks

Walk through Shadow and Light DOM recursively

。_饼干妹妹 提交于 2019-11-26 21:57:00
问题 I am trying to walk through the shadow and light DOM recursively (looking for the first input , wherever it may be). This didn't seem to be such a hard task, so I wrote the following code recursiveWalk: function(node, func) { var done = func(node); if(done){ return true; } if('root' in node){ this.recursiveWalk(node.root, func); if(done){ return true; } } node = node.firstChild; while (node) { var done = this.recursiveWalk(node, func); if(done){ return true; } node = node.nextSibling; } }