Questions tagged [shadow-root]
61 questions
0
votes
1 answer
Selenium JavaScript executor for shadow root element works fine in normal browser but does not work in chrome headless browser
I'm testing a chrome extension using selenium 4.3.0 with Java and to open a chrome extension I have to get extension id which keeps on changing for every new build developers provide. To overcome this and not hardcode extension id in code, I though…

Dev Solanki
- 109
- 1
- 8
0
votes
1 answer
Vaadin-flow: Css stylesheet import for custom components with shadow root element
I created a server-side component with a shadow-root element.. Is it possible to import a style sheet for the elements within that shadow-root? The CssImport annotation does not work, and I couldn't find anything similar, that could work?!
I could…

peter
- 3
- 2
0
votes
2 answers
Selenium & BeautifulSoup cannot find Fields table elements within #shadow_root
I have been trying to scrape data from the following site: https://developer.salesforce.com/docs/atlas.en-us.netzero_cloud_dev_guide.meta/netzero_cloud_dev_guide/sforce_api_objects_airtravelemssnfctr.htm#maincontent.
I want to obtain the Fields…

CalGrace
- 1
0
votes
1 answer
Styling elements inside shadow root
I'm trying to style an element inside of a shadow dom. I've tried a couple of things, namely the following:
Using JS:
document.querySelector('#select-input').shadowRoot.getElementById('#aab-select-label');
This returns an error stating: Cannot read…

Ricardo de Vries
- 113
- 3
- 11
0
votes
1 answer
Selecting element inside of shadow root using css
I want to fix some styling of a component which I'm importing. The component uses its own shadow root (I think), and inside of that shadow root is the div I want to add some styling to.
Now I've tried using :host(), and :host-context(), but for some…

Ricardo de Vries
- 113
- 3
- 11
0
votes
2 answers
Unable to locate "Accept" Button - Selenium - Beginner Web Scraping
I am trying to use Selenium in order to learn different ways of web scraping.
When the code is executed Firefox starts and the "accept cookies" or what ever pops up. I am unable to locate the "accept" button when inspecting the page.
my code so…

Trdlo
- 45
- 5
0
votes
2 answers
Is it semantically correct to have multiple (inner) elements with the same ID in one HTML page under different shadow roots?
I'm using Stencil to build web components and recently had a little talk with a colleague about shadowRoot and implications. Suppose I have the following simple component with a a tag which has the id of link-button. What happens in the parent HTML…

Alex
- 1,982
- 4
- 37
- 70
0
votes
0 answers
Shadowdom access form selenium javascript/typescript
I'm trying to get access to some shadow dom elements using selenium in Javascript/Typescript, but can't quite seem to get it to work as expected. I haven't been able to find any javascript specific documentation but have addapted other examples to…

Bill Warner
- 639
- 6
- 18
0
votes
0 answers
Selenium / Try to click button in shadow-root?
i try to click the cookie all accept button on this page:
https://www.tiktok.com/@shneorgru
with the following code
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from…

Rapid1898
- 895
- 1
- 10
- 32
0
votes
1 answer
ShadowRoot which is not a case of an element
I am writing a test (in Java with Selenium) where the HTML contains a shadow root as in the picture below (there are many elements are under the shadow root):
There is some code existing for other projects to get the root:
private WebElement…

Tony
- 1,127
- 1
- 18
- 29
0
votes
4 answers
Selenium | Unable to locate input element
No idea how to address this input text field element with selenium / Java (openjdk 11 2018-09-25).
I tried xpath, cssSelector etc. it never works. Its always "Unable to locate element".

pixelhead
- 35
- 8
-1
votes
0 answers
How to target a #shadow-root selector?
I want to change the background color of a button within #shadow-root through Javascript but for some reason I can't get it to change.
Here is the structure of the HTML:
let modalLaunchSelectorColor =…

Ripley E
- 9
- 3
-1
votes
1 answer
java.lang.NullPointerException error when trying to locate a shadow element with Selenium
I'm trying to locate a field to upload a file, but the element is inside a shadow-root
I tried the following code but I get java.lang.NullPointerException on shadowRoot.findElement:
private static WebElement getShadowRoot(WebDriver driver,…

MyungHee
- 23
- 7
-1
votes
1 answer
Python : Download/Scrape HTML code inside "shadow-root" nodes of pages
I am writing to ask for a hand in downloading an HTML page that contains various shadow-roots
When I try to download this page (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm) with python, the…

Emanuele Alfano
- 29
- 6
-1
votes
1 answer
Can't reach elements in shadow-root with Selenium Python
I'm having some issues to reach elements in a dropdown list with selenium.
I have a list with values that have to be insert in "Business Group" dropdown list, but the elements are in shadow-root, so I can't reach any of then.
The values that I have…

Lucas Ouverney
- 1
- 1