Forum Discussion

anumolu9999's avatar
anumolu9999
Contributor
4 years ago
Solved

Web element is not visible in testcomplete object hierarchy

Test Complete object hierarchy is not showing + icon as child under the Panel item. Below element is showing as Panel as whole but not showing any child items under it.

 

Territory Name  +

 

The above elements source code as below

<div _ngcontent-wwr-c13="" class="col-5 col-md-5 cassign-content-head mt-4 mb-4 pb-4">Territory Name

<i _ngcontent-wwr-c13="" class="fa fa-plus-circle crsassign-fa fa-crs-plus pl-2" aria-hidden="false" data-toggle="tooltip" title="Add">

</i>

</div>

 

 

Here same i tag in a <td> is able to accessible

 

Is testcomplete support these?

 

Thank you,

Anumolu.

 

 

 

  • Hi,

     

    I would say this is expected behavior: <i> tag does not represent a web element but just indicates that enclosed text must be in italics. Icon is also not a part of page DOM because it is rendered as a result of applied CSS class.

     

    If you need to click this 'icon' from your test, you may take the parent element (div) and click 5 pixels to the left from its right margin - this is where the 'icon' must be located.

    Pseudocode:

    var obj = page.Find('div', ...);

    obj.Click(obj.Left + obj.Width - 5, obj.Top + obj.Height / 2);

     

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I would say this is expected behavior: <i> tag does not represent a web element but just indicates that enclosed text must be in italics. Icon is also not a part of page DOM because it is rendered as a result of applied CSS class.

     

    If you need to click this 'icon' from your test, you may take the parent element (div) and click 5 pixels to the left from its right margin - this is where the 'icon' must be located.

    Pseudocode:

    var obj = page.Find('div', ...);

    obj.Click(obj.Left + obj.Width - 5, obj.Top + obj.Height / 2);

     

    • anumolu9999's avatar
      anumolu9999
      Contributor

      Hello AlexKaras ,

       

      I had tried to do click the + icon using coordinates. Below is how i done.

      ParentObj.Panel is the object in the hierarchy, which has no children. Panel is pointing to whole object which includes 'Territory Name' and '+'. So I took approx coordinates of + in the Panel and done the action on 'Panel' object.

      parentObj.Panel.Click(128,12);

      If we do this way, the script will fail next time when executed in different resolution machine as the AUT has responsive UI.

       

      Thank you,

      Anumolu.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > parentObj.Panel.Click(128,12);

        > If we do this way, the script will fail next time when executed in different resolution machine 

        That is why you should use not absolute hardcoded coordinates but calculate them during runtime as I suggested previously.

        (The final code may differ from the one that I suggested but I hope that you got overall idea and approach.)

         

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    We need more details in order to help

     

    What version of TestComplete are you using?

    What browser and what version of that browser are you using?

    Can you see any of the child items with Object Spy?

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for engaging in the conversation Alex and Marsha!

       

      anumolu9999 Were you able to solve this with the advice from Alex?

      If you are still facing this, please provide the Community with more info as Marsha suggests. Thank you.

    • anumolu9999's avatar
      anumolu9999
      Contributor

      Hello Marsha_R ,

       

      TestComplete Version 14.40.1658

      Browser: Chrome Version 81.0.4044.138

      There are no child items under that panel in object tree. 

       

      Thank you,

      Anumolu.