Forum Discussion

azakharov's avatar
azakharov
Contributor
10 years ago
Solved

Any plans for TR html elements support?

Hi,



Are there any plans on supporting table row html elements in object explorer?



For example:

<tr id="someRow" class="dataRow selecteddesc="some description">



I see it in Firefbug but I can't apply Find or FindChild methods to it, since it's not even displayed in TestComplete object explorer.



So, let's say I need to verify that the className of this object is 'dataRow selected', or that description is 'some description'.

I can use css selector but I would rather not, as it's not as good and fast as TC native Find or FindChild methods.



Thanks!
  • Hi Andrey,

     


    You don't see the TR nodes as you seem to use the Tree model for Web applications. You could change it to, say, the Tag model - the table (TR, TD, TH) nodes will be displayed in this case in the object tree. However, you won't be able to perform the cross-browser testing with this model.


     


    As you want to check if the page contains the HTML element with the specified attribute, I would suggest that you used the EvaluateXPath method. It searches through HTML elements by using the specified XPath expression. Refer to the "Finding Web Objects Using XPath Expressions" article for more information.


     


    For example, here is how the code may look in your case:


     




    //JScript


    var table = //obtain the table object


    table.EvaluateXPath("//TR[@id='someRow']")


    if (tmp != null)


       {


         var arr = (new VBArray(tmp)).toArray();


         // do something


       }


        else 


       { 


         // If nothing was found, post a message to the log 


         Log.Error("Nothing was found.");


       }




     

4 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Andrey,

     


    You don't see the TR nodes as you seem to use the Tree model for Web applications. You could change it to, say, the Tag model - the table (TR, TD, TH) nodes will be displayed in this case in the object tree. However, you won't be able to perform the cross-browser testing with this model.


     


    As you want to check if the page contains the HTML element with the specified attribute, I would suggest that you used the EvaluateXPath method. It searches through HTML elements by using the specified XPath expression. Refer to the "Finding Web Objects Using XPath Expressions" article for more information.


     


    For example, here is how the code may look in your case:


     




    //JScript


    var table = //obtain the table object


    table.EvaluateXPath("//TR[@id='someRow']")


    if (tmp != null)


       {


         var arr = (new VBArray(tmp)).toArray();


         // do something


       }


        else 


       { 


         // If nothing was found, post a message to the log 


         Log.Error("Nothing was found.");


       }




     

  • Thanks Tanya,



    Could you tell what browsers are supported for the Tag model? Thanks!



    Andrey.