I’m having trouble locating elements that are in DOM shadows at multiple levels, which themselves depend on where they are located in an iframe.
I understand that you first have to locate the shawdow host and then locate the element in this shadow DOM tree by referring to the shadow host.
In my example, I succeeded in defining the location of the top-level shawdow host within an iframe.
I don’t see a WebUI.switchToFrame('myPage/iframe_m3h5') in your script, which you should need to move to the <input> object that is “under” the <iframe>.
After finally using your <input> object “under” the <iframe> (setText, verify…) and before your next instruction, then don’t forget to WebUI.switchToDefaultContent().
No - I didn’t use the WebUI.switchToFrame instruction because, for the moment, I thought I could just use the 2 Settings options which are : Parent iframe and Shadow Room Parent.
But as I said in my previous answer, does this mean that this technique doesn’t work properly when there are cascading shadows?
Hello,
Thanks for your help
But maybe I’m explaining myself wrong, but I can locate my first shadow root, which is in an iframe.
I didn’t need to use the WebUI.switchToFrame instruction because in the settings for the first shadow I was looking for, I used the Parent iframe option in the settings.
However, it’s when I search for my second shadow from this first shadow, this time using the Shadow Room Parent option in the settings, that I run into a localization problem.
Should I conclude from this that when there are too many shadows in cascade, I shouldn’t use the Shadow Room Parent option? And that I should switch to developer mode by writing a few lines of script?
Thanks to your posts in which you mentioned the explicit use of WebUI.switchToFrame, I used this technique to select my iframe rather than just using the Parent iframe option (which is supposed to do the same thing).
And by doing so, the search for the various shadow objects at multiple levels inside this iframe no longer ends in failure and is now correct.
I’ve come to the conclusion that this is the best way to go in my context and that there are limits to searching for shadow objects nested within an iframe using only the Parent iframe and Shadow Room Parent properties.
It’s great to see that you gain a lot by now. Are you satisfied with what you found out now or would you like to discuss anything more in details? We are willing to support.