The recorder works fine for quickly getting some steps thrown down, but I need to be able to store and set arbitrary text. Let's say I generated a new admin user called Admin001. I want to be able to set the text for the control to be "Admin001", not whatever was recorded when I first used the builder.
I know you can do data bindings to CSV and the like, but that's too burdensome. I want to be able to write C# code to change which text is typed.
Screenshot:

Code attempt:
var loginElement = new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit.Text;
So I'm able to get the property .Text (I think), but not actually set it...
to set the property just do:
new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit.Text =
"Some Text";
or:
var loginControl = new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit;
loginControl.Text = "Some Text";
来源:https://stackoverflow.com/questions/30991370/how-to-i-inject-programmatic-text-into-my-coded-ui-test-as-opposed-to-recorded