locked
Get the Point Coordination for the Active Cell in Coded UI Test RRS feed

  • Question

  • Dear all,

    I develop a WinForm application and Coded UI Test in VS2010 Premium Edition

    and I want to do one things in Coded UI playback as following

    1. I have a Table Grid (written in Formula One Grid)

    2. I have to go to particular Cell inside the Grid (Coded UI have no extension on this control)

    3. I want to get the Coordination of the Cell (for example left, top, height and width of that cell in the Control)

    4. Move the mouse pointer to the cell based on the last step

    5. invoke Right Click action of mouse to proceed the cell action...

    I can proceed with other steps but not for step3, hence I want to ask if I have a active cell in the Grid, how can I get the Coordination of that cell?

    Best Regards

    Thursday, July 11, 2013 6:58 AM

Answers

  • Hello,

    Thank you for your post.

    I understand that you want to get the coordination of the cell because you want to mouse click the cell to proceed the cell action. If so, I think that you can get a clickable point on the cell through GetClickablePoint method. Actually you still can mouse click this cell without the coordination. When we use Mouse.Click(uicontrol, new Point(X,Y)) to click a control, the Point argument in the method is relative to the button itself. So test will not fail if the button moves around in the page. More importantly, you can completely remove the Point argument.

    For more information, please see: http://blogs.msdn.com/b/mathew_aniyan/archive/2012/03/16/faq-why-are-we-using-coordinate-based-actions-in-coded-ui-test.aspx

    If you use Mouse.Click(uISearchButton) statement to click the cell, you need to use properties in searchproperties to locate the control first. Please see: How does “Coded UI test” finds a control ??

    It seems you are hand coding the coded UI test, in this case this blog should help you:

    Hand-coding a Coded UI Test

    In addition, you can record what you want to do against the cell using Coded UI Test Builder and then check the coordination which is used to click the cell in the generated code (UIMap.Designer.cs file) and how the cell is searched. Then you can write your own code based on it.

    Hope my suggestions can help you. If I have misunderstood anything, please feel free to let me know.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Thursday, July 18, 2013 1:43 AM
    Friday, July 12, 2013 4:38 AM