Identification Function per Toolkit      

Description

Returns the test object class name of the custom control.

Syntax

function <get class name>()

Return Value

If an element is the root of the custom control, returns the test object class name. Otherwise, returns null.

Remarks
  • You can use this method if, in your toolkit, the root element of all custom controls is an element that UFT learns. With this type of function, there is no way to specify that a different element than the one being learned is the root element.
  • Define the name of the function in a Controls\CommonIdentification element in the toolkit configuration file.
Example

This example shows a function that handles all custom controls for a toolkit.

From the toolkit configuration file:

<Controls>

    <CommonIdentification type="javascript"

        file_name="MyControls.js" function="ControlFromElement"/>

...

</Controls>

From MyControls.js:

function ControlFromElement()

{

    if !(_elem.className) return null;

    var clName = _elem.className;

    

    if (clName.indexOf('myToolKit-Calendar')

        {return "myToolKit-Calendar";}

        

    if (clName.indexOf("myToolKit-Spinner")

        {return "myToolKit-Spinner";}

    

    .....

    

    return null;

}