I'm currently trying to automate the testing of a WPF application, and have several controls where the automationID is determined at run time (currently the problem is a toggle button that has been morphed into a drop down menu, where the text of the toggle button is the selected item)
To solve this I believe I could add all the available selections as search criteria and tell the search function of TestStack.White that I wish to use the OrSearchCondition property; however, I am not able to find any documentation of how to use this feature and cannot figure it out by reading through the source code.
Additionally, I have found one relevant question to this problem on GitHub, although it remains unanswered.
Since the SearchCriteria(SearchCondition searchCondition)
constructor is marked as private I don't believe their is any means for you to create a SearchCriteria
using the OrSearchCondition
. It seems like some helper methods need to be added to SearchCriteria
for allowing the user create SearchCriteria
with OrConditions
.
You can work around this by using SearchCriteria.All
then using linq to iterate over all the automation elements you get back for the property you are looking for. Although I do recommend using caching if you use this approach to prevent a ton of cross process calls.