For recording the right mouse clicks in QTP, we need to manually modify the configuration file and then load it.
This is a great article extracted from QTP Help Guide, which leads us through important steps to configure QTP to record our Right Mouse Clicks.
Step –1: Choose Tools > Web Event Recording Configuration. The Web Event Recording Configuration dialog box opens.
Step –2: Click the Custom Settings button. The Custom Web Event Recording Configuration dialog box opens.
Step –3: In the Custom Web Event Recording Configuration dialog box, choose File > Save Configuration As. The Save As dialog box opens.
Step –4: Navigate to the folder in which you want to save the web event recording configuration file, and enter a configuration file name. The extension for configuration files is .xml.
Step –5: Click Save to save the file and close the dialog box.
Step –6: Open the saved configuration file for editing in any text editor. The configuration file uses a defined structure.
The beginning of the file, which is relevant for Web objects, is shown below.
The Property Name argument controls the recording of the mouse buttons. The value of the mouse buttons are defined as follows:
Step –7: Edit the file as follows:
To record a left mouse click for the onmouseup event, add the following line:
To record right and left mouse clicks for the onmousedown event, add the following lines:
Note: Only one event, either onmouseup or onmousedown, should be used to handle mouse clicks. If both events are used, QTP will record two clicks instead of one. By default, QTP listens for the onmouseup event.
Step –8: Save the file.
Step –9: In the Custom Web Event Recording Configuration dialog box, choose File > Load Configuration. The Open dialog box opens.
Step –10: Navigate to the folder in which you saved the edited configuration file, select the file, and click Open. The Custom Web Recording Configuration dialog box reopens.
Step –11: Click OK. The new configuration is loaded, with all preferences corresponding to those you defined in the XML configuration file. Any Web objects you now record will be recorded according to these new settings.
Key Words: QTP, quickest, Right Mouse Click, Event Recording