Get Toolkit State
Description
Retrieves the state of the supported toolkit in the specified frame on the current Web page.
Syntax
function <get toolkit state> ( doc_element )
Argument | Type | Description |
---|---|---|
doc_element |
Variant
|
The document element of the frame in which the toolkit's state needs to be checked.
|
Return Value
One of the following:
- ToolkitState.UNKNOWN - The toolkit does not implement the ability to identify its state.
- ToolkitState.NOT_PRESENT - The toolkit is not present on the current page.
- ToolkitState.PRESENT - The toolkit is present on the page but information about its readiness is not available.
- ToolkitState.NOT_READY - The toolkit is present but the page is still processing the toolkit.
- ToolkitState.READY - The toolkit is ready for event registration.
Remarks
- If UFT does not recognize your custom controls correctly during a recording session, and you are able to detect the state of the supported toolkit on the Web page, you might want to try to design a <get toolkit state> method.
- During a recording session, in some cases, UFT calls the <get toolkit state> function, and can use it to wait for the toolkit to load fully before calling the Web Add-in Extensibility function that was developed to register for events.
- Define the name of the function in a Control\ToolkitStateQuery element in the toolkit configuration file.
- This feature is disabled by default. In order to enable it, set the registry key HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\Packages\WebPackage\Settings\KitsStateQueryEnabled to 1.
Example
In this example, the toolkit support set enables UFT to query the state of the supported toolkit.
From the toolkit configuration file:
<Controls>
<ToolkitStateQuery type="javascript"
file_name="JavaScript\ToolkitState.js" function="get_toolkit_state" />
</Controls>
During the recording session, UFT calls this function to find out if the toolkit is ready for event registration:
function get_toolkit_state (doc_element)
{
if ( !window.jQuery )
{
return ToolkitState.NOT_PRESENT;
} else if( window.jQuery.isReady )
{
return ToolkitState.READY;
} else
{
return ToolkitState.NOT_READY;
}
}