4

我在 Silverlight 项目中声明了一个 TextBox,其内容为“123456”,然后在 Coded UI 测试中使用以下代码。首先它搜索并单击 TextBox 以设置焦点,然后尝试删除字符。

currencyPage.ClickEditByAutomationId("textBox");
Keyboard.SendKeys("{END}");
Keyboard.SendKeys("{BACKSPACE}");
Keyboard.SendKeys("{BACKSPACE}");
Keyboard.SendKeys("{BACKSPACE}");
Keyboard.SendKeys("{BACKSPACE}");
Keyboard.SendKeys("{BACKSPACE}");

这是我的文本框中的结果文本:123456BBBBB

我究竟做错了什么?文本框的 XAML:

4

2 回答 2

7

尝试

Keyboard.SendKeys("{BACK}");
于 2011-05-17T13:25:38.507 回答
0

尝试Keyboard.SendKeys(@"{BACKSPACE}");Keyboard.SendKeys("{{BACKSPACE}}");

于 2011-05-16T21:10:01.677 回答