Pages

HOME

HOME

Wednesday, 23 January 2013

What is DrawHighlight() and when to use it ?

Using DrawHighlight()
Today we will see how/when to use DrawHighlight() method in CodedUI. The DrawHighlight method is used to highlight a control or focus on control on web page or wpf appication form i.e. User interface.
Sometime control is available on screen and even we can map it using CodedUI TestBuilder but when we try to perform any action on it then it throws exception - control not found or Cant perform click action on hidden control(if it is button control).

So in such situation we can try using the DrawHighlight method as explained below:



In above image sample demo page shown which contains a textbox and a button.
(Here it is taken for just example)

For a textbox and button control we can use Drawhighlight as below :


 public void DrawHighlightAndClick()
        {
            HtmlInputButton btnHi = this.UIDemoWindow.UIDemoDocument.UIHIButton;
            btnHi.DrawHighlight();
            Mouse.Click(btnHi);
        }

        public void DrawHighlightAndEnterInput()
        {
            HtmlEdit txtName = this.UIDemoWindow.UIDemoDocument.UITxtaNameEdit;
            txtName.DrawHighlight();
            txtName.Text = "test1234";
        }


Similarly we can use this method for any control in CodedUI, provided that control is visible on User Interface.

Enjoy Coding !!!

Friday, 18 January 2013

UITesting utility methods in CodedUI (UITestingUtilities.dll)

UITestingUtilities

There are some useful helper/ utility methods available to access more properties of a UITestControl. This will help to extend the use of CodedUI in UI testing so that we can automate more test cases. We can use these methods by adding UITestingUtilities.dll in CodedUI Testing project.

Some of these methods are as listed below:
                      MethodName          Description




Click on image to maximize

The UITestingUtilities.dll and more information on this is available at :
UITestingUtilities.dll and Helper methods in detail

Enjoy Coding!!!