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?
Asked
Active
Viewed 843 times
0
-
What do you mean by "editbox"? Do you mean an `` tag? – Simon Mourier Sep 03 '13 at 19:53
-
Sorry for the late replay... Yes, I meant – Tejas Sep 19 '13 at 16:18
-
You want to enter the edit (focus) and push text to it? also, what's "webbrowserpageviewer"? – Simon Mourier Sep 19 '13 at 16:32
-
Are you coding this or recording? If coding, which language? see this link for the how-to http://msdn.microsoft.com/en-us/library/dd465184(v=vs.100).aspx – yonitdm Oct 17 '13 at 15:01
1 Answers
-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