Excellent Content. Just to add on to this topic that I found an easier way to write all the lengthy shadow root code. Following are steps: 1)In Development Tool (F12) window> Right click the element> Copy> Copy JSPath. 2) It will provide fullJSPath of the webelement. 3) On chatgpt (or any AI platform) > paste above jspath > and enter the prompt: "You have above jspath. You have to select this webelement in Selenium4 using shadowhost and shadowroot approach" 4) It will provide almost exact code required for shadow-root hierarchy. Above approach can reduce most of the manual time required otherwise in identifying sub-elements one by one
Great Video ... why we need to use only css selector to identify shadow root inside shadow tree (why it will throw invalid locator exception ?) please explain ..
getshadowroot method is defined using css selector only. So if you give any other locator it will throw an exception. And regarding the question, why other locator don't work on shadow DOM? Because original DOM don't have any information of the element of shadow trees. Hope it answers your question.
If you see the element hierarchy then you will find the tag 'settings-appearance-page' does not come under shadow root. We can directly reach this tag element using the earlier element.
@@maximumautomation I have a I frame and inside an there is a document and inside that there is element and I need to click on it. I switched to but when iam trying to access the element . The element is not accessible because its present inside the document tag . So how to resolve this issue . Will be helpfull if u make an video aswell.Thankw in advance
Excellent Content. Just to add on to this topic that I found an easier way to write all the lengthy shadow root code. Following are steps:
1)In Development Tool (F12) window> Right click the element> Copy> Copy JSPath.
2) It will provide fullJSPath of the webelement.
3) On chatgpt (or any AI platform) > paste above jspath > and enter the prompt: "You have above jspath. You have to select this webelement in Selenium4 using shadowhost and shadowroot approach"
4) It will provide almost exact code required for shadow-root hierarchy.
Above approach can reduce most of the manual time required otherwise in identifying sub-elements one by one
Thank you for adding these details.
Do we have other way to identify element directly instead of traversing from top to bottom ? Identifying element with this approach is a tedious task.
As far as I know, this is the only option in webdriver to get the shadow elements.
I have been looking for an explanation like this, thank you very much, you did a great job
nice explanation understood the concept well.
A great explanation indeed sir .
Thanks for the detailed explanation. It is really helpful.
Nice explanation made excellent by nice speech pattern with pauses. Great job.
Thank you!
A great explanation. Thank you
Glad it was helpful!
great explanation
You’re a legend!
Glad it helped! ☺️
This is really helpful. Thanks
Glad it was helpful!
It was pretty useful for me.
Glad it was helpful!
Great Video ... why we need to use only css selector to identify shadow root inside shadow tree (why it will throw invalid locator exception ?) please explain ..
getshadowroot method is defined using css selector only. So if you give any other locator it will throw an exception. And regarding the question, why other locator don't work on shadow DOM? Because original DOM don't have any information of the element of shadow trees.
Hope it answers your question.
@@maximumautomation This answer is helpful, Thank you so much .. Looking forward ..
Dear Sir, Can you explain the code at 10:10, why did you not call getshadowhost() method?
If you see the element hierarchy then you will find the tag 'settings-appearance-page' does not come under shadow root. We can directly reach this tag element using the earlier element.
@@maximumautomation OMG Thankyou, and congratulations, Well recommended channel
love it!
Thankyou you are great
Helpful
i like this video..
but how to select time using showdow-root concept
Sorry I didn't get it. Could you please give an example?
Have a question is ist same with accessing the document element is the dom?
Sorry, but I didn't understand your question.
@@maximumautomation I have a I frame and inside an there is a document and inside that there is element and I need to click on it. I switched to but when iam trying to access the element . The element is not accessible because its present inside the document tag . So how to resolve this issue . Will be helpfull if u make an video aswell.Thankw in advance
I love you
░p░r░o░m░o░s░m░ 😕