Test Republic

Community of Software Testing Professionals

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: 194
Latest Activity: 1 day ago

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


Comment Wall

Comment

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

Deepak Pesumalani Comment by Deepak Pesumalani on July 26, 2010 at 5:59pm
Script conversion from Winrunner to QTP detail:

http://qtpknowledgesharing.blogspot.com/2010/07/script-conversion-from-winrunner-to-qtp.html
Naazia Comment by Naazia on July 2, 2010 at 11:32am
Hai Veera,interview qs varies as per ur profile..if ur profile holds qtp exp,thn qs will be based on qtp s role in your project,like how you used qtp 4 ur project and more on that point of view.If you mention tat u r a fresher in qtp,thn qs will be product(qtp) based..pls share ur email id,will send some sample interview qs.
Naazia Comment by Naazia on July 2, 2010 at 11:19am
@Sabitha,
https://h10078.www1.hp.com/cda/hpdc/display/main/index.jsp?zn=bto&cp=54_4012_100
veera jeyamani Comment by veera jeyamani on July 1, 2010 at 6:53pm
hi
Can you tell me an Intreview type of question in QTP ...
sabita Comment by sabita on June 30, 2010 at 7:36pm
Hi...
i want to learn QTP...so i joined in this group...Please suggest me...anyone is having the url of QTP to download trail version...pls post it...
Deepak Pesumalani Comment by Deepak Pesumalani on June 30, 2010 at 9:44am
Vb scripting with Classes (Nice examples) at

http://qtpknowledgesharing.blogspot.com/2010/06/vbscripting-with-classes.html

Please put your comments & Suggestion.

Have nice day.

Thanks,
Deepak
Deepak Pesumalani Comment by Deepak Pesumalani on June 28, 2010 at 10:05am
Time and date function in Vb script at
http://qtpknowledgesharing.blogspot.com/2010/06/time-and-date-function-in-vbscript.html
Deepak Pesumalani Comment by Deepak Pesumalani on June 28, 2010 at 10:04am
Hi Friends,

Good Morning

Playing with string in Vb script at

http://qtpknowledgesharing.blogspot.com/2010/06/playing-with-string-in-vbscript.html
Deepak Pesumalani Comment by Deepak Pesumalani on June 25, 2010 at 7:38pm
For defining global variable in QTP please go through (Hope this will be helpfull)

http://qtpknowledgesharing.blogspot.com/2010/06/environment-variables-in-qtp.html

http://qtpknowledgesharing.blogspot.com/2010/06/how-to-specify-environment-variables-to.html
Deepak Pesumalani Comment by Deepak Pesumalani on June 25, 2010 at 10:26am
Sorry Please ignore last comment.

Link for debugging the vbscript & Jscriopt is http://qtpknowledgesharing.blogspot.com/2010/06/debug-vbscript-jscript-from-command.html
 

Members (194)

Shreya tarun Thirupathi Sumit Kalra Arunsingh Rajathi Rajesh mpanwar nidhi Kishor Deepak Pesumalani Prasad Venkataraman Sanju Punam Ragavan Gaurav  Deore ebinezar John Mathew Israel Godwin Raj Vijayaraj Jayshree Rathod Sanjay Dange Gowtham Girish Naveen Kumar H S hari pradeep sbudakoti Manjunath  N REDDY SIVA SARAN.K Sreenath Gopalakrishnan
 
 
 

Test Republic Elsewhere

 /></a></p> <p style=

Members

  • VIKAS CHAUHAN
  • Ashish Pandey
  • EDISTA
  • Gaurav Pandey
  • Faisal Khan
  • Frank Cohen
  • Mohamed Feroz
  • Tarnnum Gupta
  • Priyanka
  • Pallavi Paurav
  • Bibhuranjan Mohanty
  • Sriharsha ks
  • Poyyahmozhi
  • sangameshwar vale
  • Selvam G

© 2010   Created by EDISTA.

Badges  |  Report an Issue  |  Terms of Service

Sign in to chat!