Forum Discussion

vishi1987's avatar
vishi1987
New Contributor
7 years ago
Solved

How to find the shadow object in DOM

Kindly help me out with the code snippet for finding the shadow DOM object.

 

I tried using the ContentDocument but it doesn't work out with me. please look into the attachment for more information. 

 

var outer = panel.contentDocument.Script('return arguments[0].shadowRoot','my-sequence-grid');

  • That's new information...and not necessarily related to the specifics of finding objects via the DOM.  In that other thread, I suggested the user open a support issue directly with SmartBear.  Have you attempted the same?

8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    How does it show in the TestComplete Object Spy when you investigate the component in question?  How does your application display in general in the Object Browser? What are you trying to achieve with this code automation code you're trying to write?

    • vishi1987's avatar
      vishi1987
      New Contributor

      My application is web application.It doesn't recognize the object using the object spy basically i am working with wijimo grid 5.0 and need to work with the cell but using the object spy i not able to find the grid cell because it comes under the shadow root.

       

      In Screenshot, it is mention id = grid-part, when i try to find the object using object spy or event using the "findchildbyxpath"  test complete not allowing me to work with the object.

    • AlanZhang's avatar
      AlanZhang
      Occasional Contributor

       

       

       

      Hello,

      I have same issue of find objects in shadow dom, the html format is looks like this:^^

      Yes, I can get objects by using Object Spy like this 

      But I could not using regulay way by using:

      page.FindChildByXPath("//*[@id='tabContainer']/responsive-tabs/responsive-tab[1]/a")

      because "PortDeposit" is an object under his shadow dom

      what method I can use for retrive this shadow object?

       

      Thanks,

      Alan