2

I just started using UIAutomation for some testing. I got the most stuff working except this seemly simple one.

I want to verify the localized text displayed in a combobox, but I couldn't figure out how to retrieve the (localized) display text (combobox items are enumeration items) using UIAutomation API.

UISpy doesn't show me the localized display text either (it shows the enum.ToString() value of the current selected item).

Your help is much appreciated.

newman
  • 6,841
  • 21
  • 79
  • 126

1 Answers1

1

From your description, it sounds like the ComboBox is bound to some enum values.

How is the string being displayed localized? In any case the ComboBoxAutomationPeer supports the ValuePattern which returns the value for the Text property on the ComboBox. So it should be possible to bind the ComboBoxText property to your localized string and thus make it available via UIAutomation.

  • Dwayne, yes, the ComboBox is bound to enum values. I didn't try your suggestion yet, but to me, this approach would defeat the purpose of UIAutomation - I want to verify the GUI elements. It also makes it more complicated (needs to share resouces with the test app). – newman Oct 02 '11 at 16:50