0

当我在窗口中检查一个按钮时,以下属性与 FrameworkId="InternetExplorer" 一起列出。如何使用 Teststack.white 自动化按钮单击或文本框填充?

这是检查员显示的:

Mouse move (865,608)
hwnd=0x00250DD6 64bit 
class="Internet Explorer_Server" 
style=0x56000000 
ex=0x0
RuntimeId:  "[42.2428374.3.3538]"
BoundingRectangle:  {l:743 t:599 r:1176 b:689}
ProcessId:  464
ControlType:    UIA_ButtonControlTypeId (0xC350)
LocalizedControlType:   "button"
Name:   "Use another account"
AccessKey:  ""
HasKeyboardFocus:   false
IsKeyboardFocusable:    false
IsEnabled:  true
AutomationId:   "otherTile"
HelpText:   ""
IsPassword: false
IsOffscreen:    false
Orientation:    0
FrameworkId:    "InternetExplorer"
IsRequiredForForm:  false
AriaRole:   "button"
4

2 回答 2

0

您的组件是一个按钮,因此您可以使用 TestStack 中的此方法:

var btn = currentWindow.Get<Button>(SearchCriteria.ByAutomationId("otherTile");
// Perform click
btn.Click();

您可以对文本框使用相同的方法,并直接设置 TextBox 的 Text 属性的值。

于 2018-10-30T20:52:42.820 回答
0

好吧,我可以使用下面的代码来实现这一点,因为这个按钮不是我们需要明确提及框架的 windows 按钮:

window.Get<Button>(SearchCriteria.ByAutomationId("otherTile").AndOfFramework(WindowsFramework.InternetExplorer)).Click();
于 2018-11-03T15:50:12.653 回答