Search code examples
c#ui-automationteststack

TestStack.White Get all Tabs


is there a way to get all elements of a specific type of a window? In my case, I want to get all tabs of the page to filter it afterwards by which has the greater Y-coord.

This method: Get<TestStack.White.UIItems.TabItems.Tab>(TestStack.White.UIItems.Finders.SearchCriteria.All) only returns the first element it finds.

Thank you and regards, Jan


Solution

  • Using SearchCriteria.ByControlType

    IUIItem[] items = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Tab));
    

    Using Linq...

    using System.Linq;
    
    ...
    
    IUIItem[] items = window.GetMultiple(SearchCriteria.All).OfType<Tab>();