Forum Discussion

mesg2anil's avatar
mesg2anil
Regular Contributor
13 years ago

How To Click Objects Whose Property Values Keep Changing

Hi,



Please find the screenshot attached.

The table which is shown having Name and Action columns, have 10 names and 10 objects under Action column. The object which is in RED color is disabled, I want to enable the object based on the value from name column list.



For Ex:

If I'm searching GARDEN SIDE value, for this value, the object on the right hand side which is in GREEN color, I want to click that object to make it inactive. How can I do that?

Each object name will be something like Item(122), Item(123), Item(124) etc, object names might change as they are dinamically allocated. Using below code, I'm finding the name which I want...




Set p = RightFrame.NativeWebObject.Find("innerText", "East Facing")

Log.Message p.Name  '== output it shows is Item(167)



This object is currently inactive, I want to click or RED button to make it active. How to do this?

Any help on this please?


p = RightFrame.NativeWebObject.Find("innerText", "East Facing").Message p.Name  This object is currently inactive, I want to click or RED button to make it active. How to do this? Any help on this please??

3 Replies

  • Hello Anil,



    As per my knowledge you are missing two thing .......first is you are not using tag value in find method and second is you are not focusing on image object ...you please try with this.

  • Hi Anil,



    As far as I understand, you are using the DOM web tree model in your project. This makes TestComplete to have all objects on the web page in a plain list without a hierarchical structure. While this approach shortens full names of tested objects, it makes it impossible to an object depending on its position in its hierarchy as in the Tree model.



    For example, in case of the Tree model, you can find the table cell object containing specific text (e.g. 'GARDEN SIDE'). Once you find this cell object, you will know that is has column index '0' and row index '8'. All you need to get the green button object corresponding to this item is to get a button object laying within a cell with column index '1' and row index '8'.



    You can find more information on web tree models in the Web Tree Models help topic.



    It is still possible to do something similar for the case of the DOM tree model, but I need to see the HTML code of the page prepare a sample script for you. If you want me to do this, please send me the text of the HTML page containing this table using the Contact Support form. You can get the HTML code of the page using this code:

    function getHTMLIExplore()

    {

      var page = Sys.Process("iexplore").Page("*");

      var htmlCode = page.Application.document.documentElement.outerHTML;

      Log.Message("See HTML in Additional Information pane", htmlCode);

    }