Working with Windows Combobox/List view controls
-
Tuesday, June 22, 2010 1:58 PM
Hi,
1. I have recorded an UI Automation test for selecting an item from the Combobox. BUt, when i tried to playback the same test, its failing with the following message:
Test method Combobox_select.Combobox.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName: 'MSAA'
Name: 'Male'
ControlType: 'ListItem'
---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002What could be the resolution for this?
2. Does it posible to select the different item from the list during playback? if so can tell me what are the modification required fro the recorded script?
All Replies
-
Wednesday, June 23, 2010 2:02 PMModerator
1. Can you give the recorded line of code which failed with HiddenControl Exception?
2. Yes, it is possible. You can override the values. Please refer Point2 in the FAQ thread in this forum.
Please mark this post as answer if this answers your question -
Thursday, June 24, 2010 5:08 AM
Hi Vishnu,
I have Gender ComboBox with the following values:
[Any Gneder] - Default value in the combobox.
Female
Male
Other
Unknown
I have recorded UI Automated Test to select the value "Male" form the list. The recorded code for the same is "Mouse.Click(uIMaleListItem, new Point(20, 8));".
Can let me know what are modification I need to do?
Thanks
-
Thursday, June 24, 2010 6:46 AMModerator
Is it a Winforms Control or some third party custom control?
Do you see a click action on combobox to expand the drop down above this action?
Ideally, CUIT records something like this for a selection in combobox.
uIGenderComboBox.SelectedItemAsString = "Male";
In your case, I see that the actions are not aggregated to a selection action. Pls give a try with the above code on your combobox object.
Please mark this post as answer if this answers your question -
Thursday, June 24, 2010 10:56 AM
I hope its Winforms as the application is developed on ".NET". Let me know if any other ways to check it.
You are right there is a action to exapnd the drop down before selection. the code goes like this:
Mouse
.Click(uIOpenDropDownButton, new Point(9, 7));
Mouse.Click(uIMaleListItem, new Point(20, 8));
I tried by replacing the second line with uIGenderComboBox.SelectedItemAsString = "Male";. Now I am getting the error:"The name 'uIGenderComboBox' does not exist in the current context".
Let me know the work around.
Thanks,
-
Thursday, June 24, 2010 11:40 AMModerator
Please use the Combobox object generated in your code instead of the 'uIGenderComboBox'. Reply to viradham at microsoft dot com if you face any difficulties in identifying the object.
Please mark this post as answer if this answers your question -
Thursday, June 24, 2010 2:10 PMThanks Vishnu.

