0

In my application, we have a webbrowserpageviewer control. when a webpage is opened, user needs to click on some of the editboxes present on the webpage. We are trying to simulate this behvior using UI Automation libraries. Am a bit new to this but I see that we can simulate button clicks using InvokePattern so is there any similar method to simulate editbox clicks?

I Bajwa PHD
  • 1,708
  • 1
  • 20
  • 42
Tejas
  • 391
  • 2
  • 7
  • 19

1 Answers1

-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)
Heeryu
  • 852
  • 10
  • 25
Shobhit_Geek
  • 591
  • 9
  • 22