Test failing for the objects captured with CUITe

Nov 3, 2011 at 4:01 PM

I have been trying CUITe to test one of our internal portals and recorded the required object for test automation. The tests are failing to identify the object during execution. CUITe recorded that object as "SPAN" whereas Coded UI Test builder identified it as "Hyperlink". While executing it is recognizing another object with different class name and inner text.


public CUITe_HtmlSpan spnSignUp = new CUITe_HtmlSpan("Class=ui-button-text;InnerText=Sign Up"); -- This is the recorded object in CUITe. When verified it coded UI test builder it identified the same object as HtmlHyperLink with the following properties: Class=button ui-button-primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover;InnerText=Sign Up");

public CUITe_HtmlSpan spnSignUp= new CUITe_HtmlSpan("Class=adjust;InnerText=Adjust View"); -- This is the object it is interacting while executin., note: I didn't capture the second object in my automation code.

I even tried doing this: CUITe_HtmlHyperlink signUp = mp.Get<CUITe_HtmlHyperlink>("Class=button ui-button-primary ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover;InnerText=Sign Up"); with no avail.

Is it a known issue?

Nov 4, 2011 at 8:09 AM

Can you try:

CUITe_HtmlHyperlink signUp = mp.Get<CUITe_HtmlHyperlink>("InnerText=Sign Up");

You may add the similar entry in Object repository too...

CUITe_HtmlHyperlink spnSignUp = new CUITe_HtmlHyperlink("InnerText=Sign Up");

I am working on new version of CUITe Object Recorder (expect with v1.05 or 1.06) which will be better at its job. I understand there are issues (it is a one man job done at free time :)), but if you understand how CUITe works, you should be able to get it handcoded and working.

Keep posting your issues on this forum.

-- Suresh Bala

Nov 4, 2011 at 8:12 AM

Another thing I forgot to mention is...

If your project is under development, you should seriously consider pushing the dev to provide unique 'id's for your controls. That will solve all such automation issues.

This is something part of core CUITe philosophy to improve automation friendliness of applications that are under development.

CUITe_HtmlHyperlink spnSignUp = new CUITe_HtmlHyperlink("Id=register01");

Nov 4, 2011 at 2:22 PM

I even tried that with no luck. The problem here is that the Page is having a main DIV tag with and ID and in that there is a child DIV which doesn't have an ID and when tried to access it with the Inner text it is failing to identify it by saying "Playback failed to access the Hidden control".  After an hour investigation I found a workaround to get the child of the main DIV tag and iterate through each child until I find the one I need and perform action. I know CUITe is just borne and it had to grow a lot but just want to make sure it identiies the object that it recognizes in the CUITe window while execution.

Thanks for the suggestion and I would defenitely talk to our dev team to have a unique ID for each control on the application.

CUITe has a long way to go.


Nov 6, 2011 at 7:35 AM

CUITe v1.05 (or may be v1.06) will have features to address similar kind of issues. You can add the main div as a control in the object repository.

And you can reach to the correct child control with helper properties specified in CUITe Framework such as .FirstChild, .Parent, .NextSibling, .PreviousSibling etc. Also a GetChildren() which return CUITe control instances.


Nov 22, 2011 at 9:50 AM

I am not sure if you have any support for assertions in CUITe, currently I am using CUITe & UImap togeather for my coded UI, wherein I am capturing my validation messages, brower url assertions using coded UI map.

As my UI is developed using CMS (Sitecore), so there are some limitations, each of my validation messages doesn't have id associated with it.

Can you please let me know, if I am doing right by combining both (CUITe & UImap) or if there is any other way to write asserts in CUITe or address the problem?



Nov 23, 2011 at 5:17 AM

You can always hand-code assertions in your test case. If you are particular about having in assertion method, have it in the object repository class as instance methods. This will give you better maintainability and readability than having UIMap.

If you plan to use CUITe, I would suggest strongly to avoid UIMaps, that is when you will get the best ROI.

-- Suresh Balasubramanian

Nov 23, 2011 at 8:30 AM

Thank you for your help, but I didn't follow your solution, can you please support it with some code samples.

We have huge codebase of our product and severeal UI flows, each flow has been covered usign traditional UIMaps, but in recent development, I am serious with using CUITe, infact I already started it, as it is easy to maintain and manage.

To accomplish this I will require your support.

Nov 23, 2011 at 11:29 AM

Sure, I will be there for your support!

hand-coding assertions (given an example on how to check if a control exists):

Assert.IsTrue(oPage.oControl.Exists, "The control doesn't exist!");

having in assertion method (in the object repository page class):

public void CheckIfControlExists() {

        Assert.IsTrue(oPage.oControl.Exists, "The control doesn't exist!");


I hope this clarifies.

Nov 24, 2011 at 8:56 AM

I have captured my validation message using CUITe recorder

public CUITe_HtmlDiv divValidationMessages = new CUITe_HtmlDiv("InnerText=The following errors were found:Please enter your account numberPlease enter your post codePlease enter your reference numberPlease enter your date of birth in dd/mm/yyyy format ");

But while doing assertion it throws exception...


The playback failed to find the control with the given search properties. Additional Details:
TechnologyName:  'Web'
ControlType:  'Pane'
TagName:  'DIV'
InnerText:  'The following errors were found:Please enter your account numberPlease enter your post codePlease enter your reference numberPlease enter your date of birth in dd/mm/yyyy format'
 Failed to find any control that matched the value The following errors were found:Please enter your account numberPlease enter your post codePlease enter your reference numberPlease enter your date of birth in dd/mm/yyyy format for the search property InnerText.

Nov 24, 2011 at 10:42 AM

Are you giving enough time for the error div to appear? Doesn't the error div have any other uniquely identifiable attribute other than InnerText?

Nov 24, 2011 at 10:53 AM

Yes, because I am able operate with other controls (textbox, button..), do I still need to set any delays?

No, DIV doesn't have any other identifier, this rendering gets rendered using CMS (Sitecore), so we can do very less on that.

And most of my tests revolves around assertion of validation messages, which gets rendered within DIV, and view source for it look like this:

<div class="errorblock"><p><strong> The following errors were found:</strong></p><ul><li>Please enter your account number</li><li>Please enter your post code</li><li>Please enter your reference number</li><li>
        Please enter your date of birth in dd/mm/yyyy format

Nov 24, 2011 at 11:54 AM

It could be possible that the assertion is getting executed before the error div is visible. Please try operating with other controls in div first and then assertion to test.

How about using 'class' as the ideantifiable attribute for the error div?

Nov 25, 2011 at 4:07 AM

Yup, I tried with class as identifier and it worked, so that means div is visible.

Thank you, Suresh :-)