Shadow dom elements

We are not able to use xpaths for Shadow dom elements? Are we going to get any such update for this?

Hi,
You can, but you also have to define Shadow Root Parent for the object

yeah, that we have tried already as currently that is the only way.
Was just asking if in near future it is going to support xpaths.

@kazurayam Do you have any idea about this ?

I have no knowledge about how Browser developers are working on Shadow dom.


I found https://stackoverflow.com/questions/49763626/can-xpath-expressions-access-shadow-root-elements they say:

Most web scrapers, including Scrapy, don’t support the Shadow DOM, so you will not be able to access elements in shadow trees at all.
And even if a web scraper did support the Shadow DOM, XPath is not supported at all. Only selectors are supported to some extent, as documented in the CSS Scoping spec.


I think that CSS Selector is mandatory to give style to web pages. Shadow DOM technology requires CSS Selector. Without CSS Selector supporting Shadow DOM, the pages with Shadow DOM will look too poor.

On the other hand, XPath is just an additive to Browsers. Browsers can live without XPath.

1 Like

Here is the Katalon plugin to automate multi-level shadow DOM elements. You can use it and help developers to improve it.