无法在编码 UI 中发送文本
Not able to send text in Coded UI
这是我的代码,我尝试将文本发送到文本框,但我不能,它不起作用。
ITestControl PointBuildWin = new UITestControl();
PointBuildWin.TechnologyName = "MSAA";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.ClassName] = "WindowsForms10.Window.8.app.0.378734a";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.FriendlyName] = "XLS80ePSPointUtility";
Thread.Sleep(3000);
WinRadioButton UpgradePointBuildBtn = new WinRadioButton(PointBuildWin);
UpgradePointBuildBtn.SearchProperties[WinRadioButton.PropertyNames.Name] = "Upgrade from earlier version of EBI and XLS80ePS";
Mouse.Click(UpgradePointBuildBtn);
Thread.Sleep(1000);
WinCheckBox PointSpecButton = new WinCheckBox(PointBuildWin);
PointSpecButton.SearchProperties[WinCheckBox.PropertyNames.Name] = "Point name specific";
Mouse.Click(PointSpecButton);
Thread.Sleep(2000);
WinEdit TextInput = new WinEdit(PointBuildWin);
TextInput.SearchProperties[WinEdit.PropertyNames.ClassName] = "WindowsForms10.EDIT.app.0.378734a";
Thread.Sleep(2000);
Mouse.Click(TextInput);
TextInput.SetFocus();
Keyboard.SendKeys(TextInput, "Test");
尝试
TextInput.DrawHighlight() 在 Mouse.Click(TextInput) 之前并确认搜索属性指向正确的控件。
这是我的代码,我尝试将文本发送到文本框,但我不能,它不起作用。
ITestControl PointBuildWin = new UITestControl();
PointBuildWin.TechnologyName = "MSAA";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.ClassName] = "WindowsForms10.Window.8.app.0.378734a";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.FriendlyName] = "XLS80ePSPointUtility";
Thread.Sleep(3000);
WinRadioButton UpgradePointBuildBtn = new WinRadioButton(PointBuildWin);
UpgradePointBuildBtn.SearchProperties[WinRadioButton.PropertyNames.Name] = "Upgrade from earlier version of EBI and XLS80ePS";
Mouse.Click(UpgradePointBuildBtn);
Thread.Sleep(1000);
WinCheckBox PointSpecButton = new WinCheckBox(PointBuildWin);
PointSpecButton.SearchProperties[WinCheckBox.PropertyNames.Name] = "Point name specific";
Mouse.Click(PointSpecButton);
Thread.Sleep(2000);
WinEdit TextInput = new WinEdit(PointBuildWin);
TextInput.SearchProperties[WinEdit.PropertyNames.ClassName] = "WindowsForms10.EDIT.app.0.378734a";
Thread.Sleep(2000);
Mouse.Click(TextInput);
TextInput.SetFocus();
Keyboard.SendKeys(TextInput, "Test");
尝试 TextInput.DrawHighlight() 在 Mouse.Click(TextInput) 之前并确认搜索属性指向正确的控件。