locked
How to click the hidden button's in an application using Coded UI test RRS feed

  • Question

  • HtmlButton search = new HtmlButton(test);
    search.SearchProperties.Add("value", "Search");

    The above code is not working.Could anyone help me to resolve this issue.

    Tuesday, April 14, 2015 7:23 AM

Answers

  • Hi Balaji,

    Based on your issue, if the button control action is not visible in the web page or windows, we will could not find and click this hidden button.

    If the button control is visible, but there have a error message said that the button is hidden control using coded UI test.

    First of all, I suggest you ensure if this button control in the range of the web page or windows. If the button control is the bottom of the web page or windows, I suggest you will need to scroll the down arrow to the bottom of the web page or windows.

    So please try to scroll the mouse wheel to find this button control in the bottom of the web page or windows using the Mouse.MoveScrollWheel() method.

    Reference:

    http://blogs.msdn.com/b/tapas_sahoos_blog/archive/2011/11/07/troubleshooting-record-and-playback-issues-in-coded-ui-test.aspx 

    If the button control is the range of the web page or windows, I suggest you could try to use of the DrawHighlight method in your coded UI test code to validate if the button control is found. Then you could try to use the following code snippet to click the checkbox control to check if it can be found:

    Mouse.Click(new Point(myUiControl.BoundingRectactangle.X + myUiControl.BoundingRectangle.Width, myUiControl.BoundingRectangle.Y + myUiControl.BoundingRectangle.Height/2));

    For more information, please see:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/0bc52d42-4a41-45bc-ad65-ae4c02696c61/cannot-perform-click-on-hidden-control-error-message-in-coded-ui-test?forum=vstest

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Tina-Shi Monday, April 20, 2015 8:06 AM
    Wednesday, April 15, 2015 5:56 AM