Selenium Shadow element? Shadow_root? Shadow_dom? Not sure how to name it

Bonvi

Power Member
Joined
Jul 15, 2019
Messages
756
Reaction score
419
How do I even do that? Everytime I run it, I can't find the element! It drives me nuts. Of course i googled and found a few entries on stack overflow but it didn't work for me.

Supposed to use it like this (direct copy):
root1=driver.find_element(By.XPATH,"//dx[@bookmark='Save']").shadow_root
root2=root1.find_element(By.XPATH,".//dx-container/div")

Tried that but didn't work for some reason.

Site looks like this:

<div class="_cell symbolName" role="cell" draggable="true" tabindex="0"><set-class binding="this.flags.symbolName" target=".."></set-class><text-binding fallbackvalue=" " binding="this.symbolName"></text-binding></div>
#shadow-root(open) == $0
"Text I want"




How would I get that element? Any clues?

Edit: Just saw there is another shadow-root element further up -.- No clue how I even deal with that.
 
The shadow dom behaves kind of like an iframe. You first need to grab the search context for the shadow dom. Use the getshadowcontext method and then use that to find your element. If you want to send over the url I can take a proper look to night.
 
Olá meu amigo, tudo bem?
Estou com problemas para encontrar uma raiz de sombra, você pode me ajudar? Você pode me enviar uma DM?
 
Back
Top