This project is read-only.

Custom Control elements

Apr 18, 2012 at 3:22 PM

Hi, I'm currently trying (and learning how) to write script for automation testing using White, NUnit and C# language. 
I'm writing script for UI testing. And on my application there is such item as SimpleBox. Its a custom control element. And I would like to ask, if there is any assembly/library for ability to write SimpleBox as class.. Or may be you can give me advice how to write script togather with all data of which consist this SimpleBox -->
I have such parameters: 
- AutomationId;
- ControlType:"ControlType.Custom"
- ClassName:"TextBox"
- ControlType:"ControlType.Edit"
- ClassName:"ScrollBar"
- ControlType:"ControlType.ScrollBar"
And all this contain SimpleBox.
This window contain a lot of SimpleBoxes, and it is no posibility to write code using ClassName: "TextBox" because of all SimpleBoxes have the same AutomationId.
Or may be you can give me better advice.

Will be very pleased if someone will help me.

Thank you in advance.

Apr 18, 2012 at 10:14 PM

You need some unique parameter to differentiate these controls. If you can't ask developers to add Automation IDs (that would be a preferred solution), you can address needed "SimpleBoxes" by index (their  appearance "number" on the page) or by position (if the GUI is more or less fixed).

Apr 19, 2012 at 3:30 AM

Best would be to ask developers to give each control a unique automation ids to each text box as said by Michaelvp above.


Look at this page for how to create a custom control class and access all controls underneath it.

Apr 19, 2012 at 9:11 AM

Ok, thanks for quick response.

If, may be, will be more ideas, I would be pleased to hear from you.

Apr 19, 2012 at 10:54 PM
loganathan wrote:
Look at this page for how to create a custom control class and access all controls underneath it.

Actually, I find the term "Custom UI Items" mentioned on this page extremely confusing, as well as the code example there.

I may be wrong, but it seems that a "Custom UI Item" is nothing more than an "business logic layer" abstraction for logical groups of usual controls, like a pane containing a group of 3 textboxes in the "MyDateUIItem" example.

It's absolutely not something like ControlType.Custom that we are looking for here.

Apr 20, 2012 at 9:07 AM

Yes, you are right. Its a pane, which consists of textboxes, image, simplebox (as a lookup which call out drop down list) and label.