Open jrd opened 6 years ago
Interesting information: https://github.com/SeleniumHQ/selenium/issues/4971#issuecomment-340230404
This would definitely be an interesting feature to explore. What I'll do in the coming week is investigate and understand interacting with the Shadow Dom via Selenium as best as I can.
As far as a possible interface for this in behave-webdriver, my main concern would be not affecting the behavior of finding elements not in a shadow dom.
As of right now, there's no provided step for locating/working with elements relative to other elements. Perhaps that may be a good angle to get at the shadow dom.
Just chiming back in. Haven't forgot about this, things have just been a bit busy.
As a next step, I'm planning to put together a scenario or two for shadow dom into the demo app. If we implement something to make interacting with the Shadow Dom easier, I'm still contemplating what an elegant interface for this might look like.
Hi @spyoungtech, I happened to find your comments while trying to figure out automating a Salesforce app that uses shadow dom, using selenium and Java. I realize now(from your comments), it's not going to be as easy I thought it would be. I was wondering if you have any updates following your investigation. Sorry, I am not trying to be cheeky, but it will be really useful to testers like me. Thanks
Hi @sunpala unfortunately I've not yet found a great way to deal with this use case. Part of the difficulty is that support for shadow dom varies widely by browser.
Another unanswered question for me is how should a user specify this?
Shadow-dom is very hard to test and to find elements.
find_element_XXX
methods cannot pass through shadow-root and therefore great deal of effort should be done to reach some element if nested shadow elements are in the path.It is also difficult to wait for some element to appear or desappear for the same reason.
is enough to reach the shadow-dom of an element and from there, any other
find_element_XXX
method will work (until reaching another shadow dom of course)Proposition to ease usage:
that splits the css selector or xpath expression to get the shadow-dom of a element and continue descending in the selection.
Rough example:
What do you think?