Subroutine to drag and drop item from windows explorer to application using UFT or QTP. By default this feature is not yet available in QTP or UFT.
QTP\UFT do not have a default functionality to drag an item from windows explorer window to application under test.
Let us consider a scenario where we want to drag an image from windows explorer to TinEye, which is one of the best image search and recognition company.
Manual steps that we would follow are
- Access TinEye website (https://www.tineye.com)
- Identify the area where a drag and drop facility is available.
- Open image location using windows explorer.
- Select the image in the folder and drag it to the website.
Here is what the subroutine does.
Parameters to pass
- FilePath – path of the file to drag and drop (e.g. “C:\Users\Public\Pictures\Sample Pictures\Koala.jpg”)
- DropAreaObject – pass the object on which file has to be dropped
- Check whether the file exist
- Create browser window object
- Create explorer windows object
- Open folder path
- Resize and move the folder window
- Select the item passed
- Detect position of the file in the explorer window
- Resize and move browser window
- Move the drop area to view
- Detect position of drop area
- Drag item from windows explorer to drop area and release mouse to drop item
Working Sample
COMMENTS