Small Cheese

How To Insert Value To The Popup Window In QTP

QTP is one of the automation testing tools that widely use to assist the business to perform regression testing on the desktop or web based application. However, sometime it can’t work as what you expect to be like there are many popup windows involve for the web based application.

I have encountered a difficulty of capturing the object in third-level popup window; the QTP totally can not identify what is the object name I am clicking on. That has created an issue for me to continue my work due to the problem of recording the object. (Perhaps it can be configured to work where I don’t really familiar with).

Finally I found the way to solve it by using the VB code (SendKeys). Before you can apply this code to the QTP script, you need to allow browser to display URL on the popup window as below.

1. Open IE and go to (Tools – Internet Options – Security tab – Custom Level button).
2. Disable “Allow websites to open windows without address or status……..” under miscellaneous category.
After you done the setting and click apply and OK to exit.

Next apply this code to your automation test script and modify these 2 lines.
Browser("").Navigate("[The popup window URL]")  //Line 1
CreateObject("WScript.Shell").SendKeys "[Value to be entered]"  //Line 2
CreateObject("WScript.Shell").SendKeys "{ENTER}"
Set WshShell = Nothing

Line 1 – Copy the popup window URL and paste it into the bracket
Line 2 – After the sendkeys command is the value that you intend to input.

Note : The code actually is for the popup window, therefore ensure you have a code that to click “something” like button or link before calling to this code.

Custom Search