UITestControl.DrawHighlight() is a very useful method (especially during debugging). It draws a blue rectangle around the UI Test Control.

 

  • For WinMenuItems, if DrawHighlight() is called, it will click on the parent menu item to make the child menu item visible and then draw the highlight.
  • For WinListItems inside a WinComboBox, if a DrawHighlight is called, it will throw a UITestControlNotFoundException. You can workaround this by explicitly clicking on the WinComboBox’s open button.
  • If you have made a control hidden in Html using CSS, DrawHighlight() will draw the the blue rectangle around the control (if it can determine the bounding rectangle).