Forum Discussion

kanhaiya_agrawa's avatar
kanhaiya_agrawa
Occasional Contributor
11 years ago

How to find the element id of all column in a dynamic grid ?

Hi ,



I have a dynamic grid whose column id is changing everytime  so i can automate those grid .



Also How can i find all element id of that grid ?





Regards,

Kanhaiya Agrawal

3 Replies

  • m_essaid's avatar
    m_essaid
    Valued Contributor
    Hi,



    Did you checked smartbear sample files in this path ?



    C:\Users\Public\Documents\TestComplete 10 Samples\Desktop\Working With Grids



    As you can read there is plenty of scripts about grids
  • kanhaiya_agrawa's avatar
    kanhaiya_agrawa
    Occasional Contributor
    Hi Mehdi ,



    I have seen the examples in that folder but can't understand much now .



    I am little new in automation using Test complete so if i playback my grid , its gives me output as :



    grdInternal    Click    ...    Clicks at point (124, 43) of the 'grdInternal' object.

    grdInternal    Click    ...    Clicks at point (110, 32) of the 'grdInternal' object.

    grdInternal    Click    ...    Clicks at point (110, 29) of the 'grdInternal' object.

    grdInternal    Click    ...    Clicks at point (76, 32) of the 'grdInternal' object.

    ClientPanel    Click    ...    Clicks at point (498, 235) of the 'ClientPanel' object.

    RibbonControl    Click    ...    Clicks at point (1258, 18) of the 'RibbonControl' object.

    ComboBoxEdit    DropDown        Opens the 'ComboBoxEdit' drop-down window.

    ComboBoxPopupListBox    Click    ...    Clicks at point (24, 24) of the 'ComboBoxPopupListBox' object.

    grdInternal    Click    ...    Clicks at point (163, 33) of the 'grdInternal' object.

    ComboBoxEdit    DropDown        Opens the 'ComboBoxEdit' drop-down window.

    ComboBoxPopupListBox    Click    ...    Clicks at point (36, 35) of the 'ComboBoxPopupListBox' object.



    so could you please tell what kind of controls it has and accordingly which script is useful for me in above example folders.





    Also attached screen shot of that.



    Regards,

    Kanhaiya Agrawal
  • Hi Kanhaiya,



    I think you can try this for dynamic datagrid.



    Property to get row count: Aliases.datagrid.rowcount

    Property to get column count: Aliases.datagrid.columncount



    To get element in each cell:

    set obj = Aliases.WinFormsObject("dataGridView").Item(x, y)



    where x & y values are given by loop which are based on the the values of row count and column count respectively. obj is the object in that cell.



    I hope this will help you.



    Thanks,

    Mayank