Stage 6: Changing the Name of the Test Object
In this section, you modify the toolkit support set to instruct UFT One to name the WebExtBook test object according to its title, as per your plan (Planning Support for the Web Add-in Extensibility Book Sample Toolkit).
When UFT One creates the test object that represents a control, it calls the get_property_value function (used for retrieving test object identification property values) with the argument logical_name to determine the name for the test object. You can implement the get_property_value function accordingly, to customize the name UFT One gives the test object. If the get_property_value function does not support the logical_name property, the test object is given the name of the test object class (followed by an index, if there is more than one object of the same test object class on the same page).
To customize the name of the test object:
In the get_property_value function in the WebExtBook.js file, replace the lines:
if ( prop == "title" ) // For the "title" identification property,
with the lines:
if ( prop == "logical_name" || prop == "title" ) // For the "title" identification property, as well as // the "logical_name" property
Note: You can modify the WebExtBook.js file in the toolkit support set folder and then later deploy it to UFT One for testing, or you can modify <UFT_One_installdir>\dat\Extensibility\Web\Toolkits\WebExtSample\WebExtBook.js directly.
The get_property_value function now returns the same text for the logical_name property that UFT One uses to name the test object, as it does for the title identification property. (Modify the comment that explains this function accordingly. At the end of the comment, add the following: as well as the hard coded "logical_name" property that UFT One uses to name the test object.
)
To complete this stage, perform the procedures in Deploying and Testing the Toolkit Support Set (for Stage 6).