Forum Discussion

Mia's avatar
Mia
Contributor
10 years ago
Solved

Accessing to PopUp window controls using item caption (not indexes)

Hi,



I am analysing an easy application to get to know how to work with WPF in TC9 using Record & Playback testing method. I found very problematic to work with PopUp windows, or - to be exact - with controls in the PopUp.



When I am accesing classical listboxes in the MainWindow, script is generated with item caption.

Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.listBox.ClickItem("Item1");



When I am accesing listbox in the PopUp - script is generated with item index. And If I rewrite the index to caption I get an error: The control item 'Item6' not found.

But the item is there, the popup wnd is visible and loaded.



I cannot use indexes for testing of our application, because the content of listboxes is changing all the time.

Is there anything what I can do to fix it? Or should our developers change something in the code?



Thanks.



  • Hi Miriam,

     


    You may not get access to this object by name if the Data Binding is used to populate your popup. Please check that with your developers. In this case, accessing only through index is possible. Refer to this thread - it contains the sample function to overcome this issue.

1 Reply

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

     


    You may not get access to this object by name if the Data Binding is used to populate your popup. Please check that with your developers. In this case, accessing only through index is possible. Refer to this thread - it contains the sample function to overcome this issue.