lundi 22 juin 2015

How to I inject programmatic text into my Coded UI test (as opposed to recorded text) in Visual Studio?

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:

enter image description here

Code attempt:

            var loginElement = new UILoginInternetExploreWindow().UILoginDocument.UIUserNameorEmailAddreEdit.Text;

Aucun commentaire:

Enregistrer un commentaire