none
Coded UI :How to find element (Group control) which doesn't have any unique property e.g. name,friendlyname,classname,id

    Question

  • I'm using coded ui with Visual Studio2010

    And Unable to find some menu Item,

    As parent of these menu items doesn't have any unique property value.

    Below is screenshot of property details of Group control  ( using Inspect.exe )

    I want to perform click action on children menu item of this Group control popup.

    can any one suggest code using which I can find this group control and it's children elements.

    Group Control

    And detail property of children menu item is as below :

    Menu Item




    • Edited by _Devang Wednesday, January 25, 2017 12:44 PM
    Wednesday, January 25, 2017 12:42 PM

All replies

  • Hi _Devang,

    Welcome back to MSDN forum.

    The properties you got by using inspect.exe might not be same name as captured by Code UI Test Builder.

    I suggest you capture the group control first with coded UI test builder, and then capture the children controls (menu items) by using sendkeys() method, like keys “up”, “down”.

    And you could refer to the following case, my answer has demonstrated the method.

     https://social.msdn.microsoft.com/Forums/vstudio/en-US/fd51d038-c3ae-4461-8038-ff138a4d276d/coded-ui-how-to-have-mouse-right-click-operations?forum=vstest

     

    I totally understand your feeling, that you are still waiting for the response to this feedback of your last thread:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/6ee33351-ab9f-41d7-9bdf-6b2f7186b21a/coded-ui-how-to-select-element-from-list-which-get-closed-when-we-click-crosshair-tool-on-test?forum=visualstudiogeneral#c6b11c6b-843b-4f03-b89a-2b394e5454c1

    I am waiting for it too, and let’s give them some more time, and I think the engineers from Microsoft will take it seriously.   

    It’s absolutely okay that you can unmark it as you want, but I still think it would be better to let more members to notice it who will get the same issue as that.

    And it is a very issue of VS2010 that need to be fixed in Windows 8 and later, I just got a blog about it today, you could see it below:

     https://blogs.msdn.microsoft.com/mathew_aniyan/2012/03/12/where-did-wini-go/#comment-2795

    I really appreciate your kind patience and precious time, and thanks for your support and cooperation:)

    Best regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, January 26, 2017 9:08 AM
  • Thanks, appreciate your response.!

    Yes.! you're write i was expecting some reply on previous question,But unfortunately didn't get any response and after that i was trying to locate element using hand code.

    As you know this issue with VS 2010,I've also tried to locate this element using up-grated VS version.Using which I'm only able to capture parent window and not children elements (List Items),and for parent window Coded ui builder display only two property  1. control name - Group and 2. technology - MASS.so,i thought Inspect.exe might be help full.

    Friday, January 27, 2017 9:50 AM
  • Hi friend,

    I understand you, and the point is to find the control’s property. But as I know, the properties captured by Inspect.exe and coded UI test build are different. If we could get the real properties of the controls, we’ll try hand coding like below:

    //1st Create control for Menu
    UITestControl menu = new UITestControl(parentcontrol); //you need have parent of menu and pass it here
    menu.TechnologyName = "MSAA";
    menu.SearchProperties.Add("Id","xxx","ControlType","xxx","Class","xxx"...etc); //if you have a unique Id then no need to add any other search properties
    
    //2nd Create control for menu list
    UITestControl menuList = new UITestControl(parentcontrol); //u need to have parent of menulist and pass it here
    menuList .TechnologyName = "MSAA";
    menuList .SearchProperties.Add("Id","xxx","ControlType","xxx","Class","xxx"...etc); //if you have a unique Id then no need to add any othersearch properties
    
    //3rd create the menu item to click 
    UITestControl menuItem = new UITestControl(menuList); //passing menuList as parent
    menuItem.TechnologyName = "MSAA";
    menuItem.SearchProperties("Id","xxx","InnerText","xxx"...etc);
    Mouse.Click(menu);
    menuItem.WaitForControlReady();
    Mouse.Click(menuItem); 
    

    I hope it could be helpful.

    Best regards,

    Fletch


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 30, 2017 10:27 AM