When manually coding CodedUI Tests, is there a way to clear text input before filling it out?

My goal is to clear the text input before filling it out.

For example, I fill out the form fields using:

Keyboard.SendKeys(myInput, "Some Text");

My form fills in the fields when the page loads using cookie values.

When I try to use CodedUI to populate an email field, it adds a string to the current value instead of adding only the desired value.

My goal is to use CodedUI to populate the email field:

  • foo@bar.com

But since the field is already aaa@bbb.com (filled with cookie data when the page loads), it ends:

  • aaa @ bbb.comfoo @ bar.com
+4
source share
3 answers

. :

myInput.Text = "";
Keyboard.SendKeys(myInput, "Some Text");
+4

, , , .

Mouse.DoubleClick(myInput)

, cookie

BrowserWindow.ClearCookies()
+1

I have successfully used the following:

control.SetFocus();
Keyboard.SendKeys("a", System.Windows.Input.ModifierKeys.Control);
Keyboard.SendKeys("{Delete}");
Keyboard.SendKeys(control, value);
+1
source

All Articles