in flight reservation application. when i entered flyto
combobox as london. and i have to check this london is
present in flyfrom combobox.give me the code with good
explanation.

extention to this question.
at each iteration i have to put(WRITE) the fly from
and fly to city in database table



in flight reservation application. when i entered flyto combobox as london. and i have to check th..

Answer / baba

invokeapplication "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"

dialog("Login").WinEdit("Agent Name:").Set "baba"
Dialog("Login").WinEdit("Password:").SetSecure
"489ff6345f83ebb85f1f91f6e86ee1c1f7a8307c"
dialog("Login").WinButton("OK").Click


msgbox now

window("Flight Reservation").WinEdit("Date of Flight:").Set
"09/09/09"

'''''''''''''''''''''''''''' Fly From
'''''''''''''''''''''''''''

expval="London"

i=window("Flight Reservation").WinComboBox("Fly
From:").GetItemsCount
msgbox i

y=window("Flight Reservation").WinComboBox("Fly
From:").GetContent
msgbox y

For j=0 to i-1
x=window("Flight Reservation").WinComboBox("Fly
From:").GetItem(j)
datatable.SetCurrentRow(j+1)
print x
datatable("Fly_From",1)=window("Flight
Reservation").WinComboBox("Fly From:").GetItem(j)
If (expval=x) Then
window("Flight Reservation").WinComboBox("Fly
From:").Select(j)
End If
Next


''''''''''''''''''''''''''''''' Fly To
''''''''''''''''''''''''''''''
expval1="London"

k=window("Flight Reservation").WinComboBox("Fly
To:").GetItemsCount
msgbox k

l=window("Flight Reservation").WinComboBox("Fly To:").GetContent
msgbox l

For m=0 to k-1
datatable.SetCurrentRow(m+1)
n=window("Flight Reservation").WinComboBox("Fly
To:").GetItem(m)
print n
datatable("Fly_To",1)=Window("Flight
Reservation").WinComboBox("Fly To:").GetItem(m)
If (exp1=n) Then
window("Flight Reservation").WinComboBox("Fly To:").Select(m)
else
reporter.ReportEvent micPass, "Validation is
correct","London is not matching in Fly To: field"
End If
Next

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More QTP Interview Questions

how to identify the objects if application consists of objects that have same properties.

4 Answers  


I have a WebEdit Object.It is added in object repository.It has two properties Name and Index.In the next release the Name Property is same but the index property is changed.when i run the script will the script Pass or Fail

9 Answers   ADP,


How to retrive XML file data in QTP ? using Script(Chandana)

6 Answers   Wipro,


i need the licence key for QTP V9.5 can anyone help me on getting this?

140 Answers  


If you are testing a web application then what will you test in that application?

0 Answers   Infosys,






what is frame work of qtp?

4 Answers   ITC Infotech, KPIT,


What are the factors on which script execution time is dependent?

0 Answers  


i have opend 2 gmails i am working with 1 gmail i want to close other gmail by usig script. 2.i have 10 links in a page all of them have same properties& names i want to click on 5link by using script. 3.i have one combobox in that i want to see all the citynames in the combobox and i have to check weather hyderabad is present or not. 4. size of objectrepository. 5.what r problems we get during writing the script. 6.is it possible to compare to excel sheets in qtp if possible wht is the script. 7.example for lowlevelrecording

3 Answers   Semantic Space,


How can the name of a checkpoint be changed in Qtp

2 Answers   Ordain Solutions,


In QTP what is the difference between Step-in, Step-out, Step-over ?

3 Answers   CTS,


How can we use XML in QTP?

1 Answers  


what type of scripts are asked in qtp?

2 Answers  


Categories