Information

QTPPro

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

Website: http://makeqtpeasy.blogspot.com
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
Next

'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.

QTP FREE DEMO

Started by QTP Help Feb 3, 2012.

Comment Wall

Comment

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

Comment by akshar jain on December 28, 2010 at 1:50pm
I think ur question is not that precise but still FYI I recommend Tarun lalwani's book for all ur QTP queries. For validation purposes we can use CheckProperty method & Getroproperty for retrieving n comparing.
Comment by Raghavendar reddy on December 28, 2010 at 12:02pm

Can any once explain more about Descriptive programming.

what I am excepting is  how we need to check .when we need to go for that.

is there any good book or material there?

pls let me know.


Comment by Hrushi Keshava HS on December 14, 2010 at 11:03am

Hi all

 

Regards

Hrushi Keshava

Comment by Ashwani Sharma on December 9, 2010 at 12:35pm
Thanks Akshar,

I got it.
Comment by Sureshkumar seeralan on December 9, 2010 at 10:59am
Hi All,if anyone looking for job change with QTP exp,please forward ur profile to suresh.tester2005@rediffmail.com,
Thanks
suresh
Comment by akshar jain on December 8, 2010 at 10:54am
Hi Ashwani,

I have forwarded the dumps..Kindly check n let me know if u need any further assistance
Comment by Ashwani Sharma on December 2, 2010 at 3:21pm
hi,
pls send me the dumps at ashwanisharma@gmail.com
regards,
ashwani
Comment by Ashwani Sharma on December 2, 2010 at 3:19pm
hi,
pls send me the dumps
regards,
ashwani
Comment by Shreyya on December 2, 2010 at 2:58pm
Thanks Akshar, I appreciate a lot , kind of u

regards,
Comment by akshar jain on December 2, 2010 at 9:54am
Hi Shreyya,

I have got 9.2 dumps n I have fwd d same
 

Members (294)

 
 
 

© 2014   Created by Test Republic.

Badges  |  Report an Issue  |  Terms of Service