Thursday, June 5, 2008

QTP - Handling Dynamic objects

Most of the QTP (Quick Test Professional) users are using playback methods to develop the scripts. Here I have given a code snippet to handle dynamic objects. You can put the object physical description directly. You can develop the script with Object Repository.

Code: Login for Mercury Flight

Dialog("nativeclass:=#32770","text:=Login").Activate Dialog("nativeclass:=#32770","text:=Login").WinEdit("nativeclass:=Edit","attached text:=Agent Name:").Set "tester1" Dialog("nativeclass:=#32770","text:=Login").WinEdit("nativeclass:=Edit","attached text:=Password:").Set "mercury" Call wait(2) Dialog("nativeclass:=#32770","text:=Login").WinButton("nativeclass:=Button","text:=OK").Click

Code: Browser certification dialog
If Browser("name:=Certificate Error: Navigation Blocked").Page("title:=Certificate Error: Navigation Blocked").Exist(0) Then ' To DO End If


Ravinder Singroha said...

How can i handle Popup in QTP by descriptive programming

Thanks & Regards
Ravinder Singroha

Palani Selvam said...

Assume that popup is not a DialogBox and it is browser page. The popup also can handle by DP.