This is a group, where all the QTP Professionals can join and share there knowledge by posting the Queries or answering the queries.

Members: 294
Latest Activity: Jun 7

Different Ways to click a button

Here i am giving an idea of how we can write the scripts in different ways..
Here i am taking an example in how many ways we can write a statement to click on a specified button.
I took two conditions first one is when we are using object repository, second one is when we are not using object repository
(Using Descriptive programming) .

Using Object Repository

'1st method
Window("Flight Reservation" ).WinButton( "Update Order").Click 'Common Method

'2nd method
Set wndObject=Window( "Flight Reservation" ) ' Assigning window object to an object variable
wndObject.WinButton ("Update Order").Click ' Following normal syntax ( click on a button)

' OR

Set btnObject=Window( "Flight Reservation" ).WinButton( "Update Order") ' Assigning Button object to an object variable
btnObject.Click ' Clicking on button using button object variable

'3rd method

With Window("Flight Reservation" ) ' Using With statement
.WinButton(" Update Order").click
End with

Using Descriptive Programming

'4th method

Window("text: =Flight Reservation" ).WinButton( "text:=&Update Order").Click ' Descriptive programming

'5th method

Set oDes=Description. Create ' creating a description object
oDes("nativeclass" ).value=" Button" ' assigning description to the description object
oDes("text") .value="&Update Order"
Window("text: =Flight Reservation" ).winbutton( oDes).click ' clicking on button using the created description object

'6th method

Set oDes=Description. Create ' creating a description object

set btnObjList=Window( "text:=Flight Reservation" ).ChildObjects( oDes) ' Flitering the objects
For objIndex=0 to btnObjList.count- 1
propVal=btnObjList( objIndex) .getroproperty( "text") ' Get property value from object
If propVal="&Update Order" Then ' Compare property value
btnObjList(objIndex ).click ' Click on identified object
Exit for ' Exit For loop after clicking on the button
End If

'7th method

Public const wndFlight="text: =Flight Reservation" ' Assigning window object description to a constant
Public const btnUpdate="text: =&Update Order" ' Assigning Button object description to a constant

Window(wndFlight) .winbutton( btnUpdate) .click ' Click on a button using description constants

Discussion Forum

Unable to focus on Wpf Object

Started by Sushanth Dec 26, 2013.


Started by QTP Help Feb 3, 2012.

Comment Wall


You need to be a member of QTPPro to add comments!

Comment by Edwin on August 10, 2012 at 10:08am

Hi Everyone,

I just started a new blog for QTP learners, daily random updation in progress for the blog, here we can learn a very easy definition for each and every QTP functions, Properties, and also for the scripts, the beginners who willing to learn QTP can use and join this blog

So for any quries, suggestios are warmly welcome to my emailid.

Comment by Shreyya on August 17, 2011 at 6:35pm

Cud anyone pls help me to get QTP 11 patch for Internet explorer 8 ? where can i download this from ?


Thanks !!!

Comment by Pankaj Kapruwan on June 7, 2011 at 9:50am
Thnx Shreyya and Deepak..
Comment by Deepak Pesumalani on June 6, 2011 at 10:42pm
Comment by Shreyya on June 6, 2011 at 6:28pm


About Environment variable, functions and usage - in QTP


ps- ..not only the article , ofcourse comments are useful too !

Comment by Pankaj Kapruwan on June 3, 2011 at 6:26pm


can any one explain me Environment Variable in QTP and why we using this?

I mean its functionality and uses.

Comment by Rengarajan Rajesh on February 26, 2011 at 12:14pm


Is that possible to comapre 2 microsoft powerpoint report using QTP.Report will have,table with values and the table will be in Image.I have a tool whic h is doing a comparison but would like to know whether comparison can be done using QTP?

Pls reply

Comment by Deepak Pesumalani on February 14, 2011 at 10:57am
Last weekend was my most productive weekend Finally I gave the look to my blog which I was looking
Comment by Shreyya on February 10, 2011 at 9:39pm

Hello All !


When using datatables , In result report generatd by qtp , we receive results as per the number of rows in the datatable and for each iteration you have following format


qtp test name (row 1) -- -

qtp test name (row 2)-- -


can i have names , instead row 1 and row 2 ?


please help


Thank you !!!!!!!!!!

Comment by Deepak Pesumalani on February 10, 2011 at 11:21am

Members (294)


© 2014   Created by Test Republic.

Badges  |  Report an Issue  |  Terms of Service