0

在我的应用程序中,我们有一个 webbrowserpageviewer 控件。打开网页时,用户需要点击网页上的一些编辑框。我们正在尝试使用 UI 自动化库来模拟这种行为。对此有点新,但我看到我们可以使用 InvokePattern 模拟按钮点击,那么有没有类似的方法来模拟编辑框点击?

4

1 回答 1

-1

You have two ways as far as i know to edit the text boxes:

1.You can add a text in text box using a pattern provided by UIA. This pattern is called ValuePattern.

In C# you can do this in this way:

ValuePattern vp = element_object.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
vp.SetValue(value_to_set);

2.You can get the bounding rectangle of text box using the AutomationElement properties after that you can click within it.

Getting bounding rectangle in c#:

automationelement_object.GetCurrentPropertyValue(AutomationElement.BoundingRectangleProperty)
于 2014-03-28T22:01:57.527 回答