Site Loader
Auckland, New Zealand
When we work with UI test controls in coded UI tests they are separated into two parts: actions and properties.
  • The first part consists of actions that you can perform on UI test controls. For example, coded UI tests can simulate mouse button clicks on a UI test control, or simulate keys typed on the keyboard to affect a UI test control.
  • The second part consists of enabling you to get and set properties on a UI test control. For example, coded UI tests can get the count of items in a ListBox, or set a CheckBox to the checked state.

Get and Set Properties

To get and set UI property value of any control, we directly set or get the value of property using
UITestControl.GetProperty()
or
UITestControl.SetProperty()
The UITestControl.GetProperty will try to get a value out from the property, for example, if we need to get a value of “DisplayText” property or “FriendlyName” property from a checkbox, then we can use the
 UITestControl.GetProperty("DisplayText")
to get the value from the control. Similarly we can set the property for a control. For more information on Get and Set property, please watch the video below Please leave your comments and thanks for reading the blog and watching the video. Thanks, Karthik KK

Post Author: Karthik kk

3 Replies to “Get and Set Properties in Coded UI Testing”

  1. I am following your video series for learning CodedUI. I tried using GetProperty() and got succeeded. But while trying SetProperty(), I am facing lot of issues. I am unable to set value for any attribute. Please sent me any sample code for setting value for any attribute.

    Thanks,
    Praveen

Leave a Reply

Your email address will not be published. Required fields are marked *