Tutorial-4 Recording of Tests in QTP with Drag and Drop Web Elements
This short tutorial guides you to the process of Recording and Running of tests in QTP involving web application has drag and drop of elements
QTP does not record web drag and drop events such as ondragstart and ondrop by default. QTP needs to be configured to capture these events.
In QTP goto the Tools->Web Event Recording Configuration and click the Custom Settings button.
Save the settings to an XML file.
Open the XML file in notepad and enter the following two XML lines of code under
“Object Name=”Any Web Object””
“Event Name=”ondragstart” Listen=”1″ Record=”2″”
“Event Name=”ondrop” Listen=”1″ Record=”2″”
In the custom settings screen, select Load Configuration from the screen anbd load the modified XML file. If you click on “Any Web Object”, now it should show on the list that it is capturing the events ondragstart and ondrop.
When recording a test you will now see that QTP is capturing the drag and drop events. The code will show that webElement(“”).FireEvent “onDrop”
If the drag and drop code uses Javascript to pass data through the clipboard for the drag and drop operation, code needs to be changed. Since the event is executed from externally, Javascript is not able to get a handle to the clipboard. The code might look like this:
varoData = window.event.dataTransfer;This code needs to be changed to:
var oData = window.clipboardData;
Many More Tutorials on HP QTP 11.0
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.