I am writing Coded UI Tests in Visual Studio and need to know the best way to find elements on a page. Would it be better to use the element's class or some other attribute?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
In my experience, it will greatly depend on how your developers choose to add attributes to elements. For example, if the element that you need to interact with has an ID, you can use that as a SearchProperty to assist in finding the element that you need:
Using something like this will provide you with a collection of elements that match the specified criteria. I suggest playing around with these SearchProperties and examining your codebase to determine the best course of action for your Coded UI tests.