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”
varoData = window.event.dataTransfer;This code needs to be changed to:
var oData = window.clipboardData;
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.