shadow-dom

Shadow-dom support for selenium

谁说我不能喝 提交于 2019-11-28 08:43:32
I am working on an automation project which uses shadow dom extensively. So every time using execute_script function to access shadow root for eg. root = driver.execute_script('return document.querySelector(".flex.vertical.layout").shadowRoot') Then use the root to access the elements within. Since we have shadow roots at many levels, this is annoying me a lot. is there any better solution exist than this to access elements within shadow root? I am using Chrome 2.20 driver. By googling I found another workaround for this problem - which is using The "/deep/ combinator". for example, I was able

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

拜拜、爱过 提交于 2019-11-28 08:08:11
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? ::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/ https://developers.google.com/web/updates/2016/02/css-variables-why-should-you-care?hl=en http://blog

Shadow DOM styling from the outside

99封情书 提交于 2019-11-28 07:13:43
问题 I am searching a way to styling shadow DOM from the outside. For example, I would like to set the color of all text in all 'span.special' elements as RED. Including 'span.special' elements from shadow DOM. How I can do this? Previously there were ::shadow pseudo-element and /deep/ combinator aka >>> for this purpose. So I could write something like span.special, *::shadow span.special { color: red } But now ::shadow , /deep/ and >>> are deprecated. So, what do we have as a replacement of them

Bootstrap.js not working in Polymer components

烈酒焚心 提交于 2019-11-28 07:04:20
I'm currently working on translating our current Dart Web UI project to Polymer.dart. We use Bootstrap 3 for the front-end styling and many web animations (e.g. dropdown menus, modals, tooltips). However after I translated one Web UI component into Polymer, all the Bootstrap JavaScript stopped working for the sub component, since it was now encapsulated in the ShadowDOM. To access an element in the ShadowDOM from Dart I have to use the shadowRoot field, and from JavaScript in Chrome I have to use the webkitShadowRoot property, but still I can't get a single dropdown menu to work properly.

Using JS to enter text, but if I input text in one text box, the value already entered is getting deleted

心已入冬 提交于 2019-11-28 06:39:29
问题 I have 3 text box in a row, and I am using JS to input the texts in the text boxes. But the problem is when I enter the text in one field, and go to second box to enter the text, the value from first text box is removed. we are using the below code to input text ((JavascriptExecutor) webDriver).executeScript( "arguments[0].setAttribute('value','"+inputText+"')", element); 回答1: Try the following : String js = "arguments[0].setAttribute('value','"+inputText+"')" ((JavascriptExecutor) webDriver)

Using querySelector to find nested elements inside a Polymer template returns null

泪湿孤枕 提交于 2019-11-28 06:24:51
I'm trying to use paper-tabs inside new element (tabs-list) but after print tabs I can't use querySelector to change selected one. Element code (without style): <link rel="import" href="../components/polymer/polymer.html"> <link rel="import" href="../sprint-service/sprint-service.html"> <link rel="import" href="../components/paper-tabs/paper-tabs.html"> <polymer-element name="tab-list" attributes="show"> <template> <sprint-service id="service" sprints="{{sprints}}"></sprint-service> <paper-tabs selected="all" valueattr="name" self-end> <paper-tab name="all">ALL</paper-tab> <template repeat="{

Can a Shadow DOM secure my elements?

不羁的心 提交于 2019-11-28 05:59:42
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 / security issue. Second approach: an iframe I don't want ExampleSite to have access to their friends' names

How to create a cross-browser sub document with iframe or shadow dom?

烈酒焚心 提交于 2019-11-28 02:36:39
问题 I want to create a totally encapsulated sub-document in JavaScript, with its own <head> , <body> , styles, html, and js. Basically a shadow dom, or an iframe, but without an src attribute. Though I love the idea of shadow dom, its support is very low, and thus is not ready for prime time. So I have been working on creating an iframe, but have been hitting various road-blocks along the way. Here is a jsFiddle demonstrating my various attempts. The iframe cannot exist in the dom. This part is

How to automate shadow DOM elements using selenium?

笑着哭i 提交于 2019-11-28 02:23:06
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 in advance !. To demonstrate automation of shadow DOM using Selenium v3.x , ChromeDriver v2.46 and

What goes wrong when a display:inline custom element contains display:block elements?

Deadly 提交于 2019-11-28 02:05:19
I'm building a custom element to mark up examples (play with it at http://jsbin.com/kiboxuca/1/edit ): <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.0/platform.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.2.0/polymer.js"></script> <polymer-element name="my-example" noscript> <template> <style> :host { display: inline } </style> [ <em>Example:</em> <content></content> — <em>end example</em> ] </template> </polymer-element> <div> Some text <my-example>Introduction <pre>Some code here</pre> More example</my-example> </div> This produces the appearance I want: