Hamish Grubijan
Hamish Grubijan

Reputation: 10820

How to customize a CodedUI test search property - specifically window title

Suppose I am trying to automate notepad, and depending on what is open, the tile of the window is either "Notepad", "Notepad - letter_to_boyfriend.txt", "Notepad - Readme.txt", etc.

When I recorded the coded ui test, it assumed the title "Notepad". Now I want to customize the test somehow, so that any title that looks like "Notepad*" would be good enough.

How can I do so? Sorry, I do not have recorded code to share at the moment, but I might later. Hopefully it is not that hard to reproduce.

It has got to be the search property. Thanks in advance.

Upvotes: 0

Views: 5575

Answers (2)

krishna
krishna

Reputation: 1

Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.TopLevelWindow;

For more help: Here

Upvotes: -1

Attila Szasz
Attila Szasz

Reputation: 3073

Doubleclick on the [mapname].uitest, in the UI Control Map select your window, press F4 to see properties, and finally in Search Properties change the Operator from EqualsTo to Contains and the Value to "Notepad".

Upvotes: 3

Related Questions