Hello! i am having two comboboxes.Each having 10 items in
it.when i select first item in first combobox,it is not
similar in the second combobox.for ex in first combo if it
is Hyderabad,in second it should be some chenai or some
other item .Write a VBSCRIPT for that?

Answers were Sorted based on User's Feedback



Hello! i am having two comboboxes.Each having 10 items in it.when i select first item in first com..

Answer / rayudu

suppose in our flight reservation window "Fly from"
and "Fly To" comboboxes values should not be same.ok.
In taht situation below code will give all fail status
because Our flight reservation window has both values same

Just understand the code and implement it on ur application

SystemUtil.Run "C:\Program Files\Mercury
Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe","","C:\Program
Files\Mercury Interactive\QuickTest
Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "rayudu"
Dialog("Login").WinEdit
("Password:").SetSecure "49192ea21d0ec541ad12119e494c01ba2bb
d510b"
Dialog("Login").WinButton("OK").Click

a=window("Flight Reservation").WinComboBox("Fly
From:").GetROProperty("items count")

b=window("Flight Reservation").WinComboBox("Fly
From:").GetROProperty("all items")

a1=window("Flight Reservation").WinComboBox("Fly
To:").GetROProperty("items count")

b1=window("Flight Reservation").WinComboBox("Fly
To:").GetROProperty("all items")

spl=split(b,vblf)
spl1=split(b1,vblf)
For i=0 to a-1
val=spl(i)
msgbox val
val1=spl1(i)
msgbox val1
If val=val1 Then
reporter.ReportEvent micFail,"Step1","Test case is
fail"
Else
reporter.ReportEvent micPass,"Step1","Test case is
pass"
End If
Next

Is This Answer Correct ?    7 Yes 1 No

Hello! i am having two comboboxes.Each having 10 items in it.when i select first item in first com..

Answer / ravikumar

Lets take Combo1 & Combo2

If u r selecting < Item1 > from Combo1 the same item1
should not be present in the Combo2 right..
if it is the case

step1) select Item1 from Combo1
Step2) write a function to validate the given item i.e
passed as perameter(Item1)by getting the innertext of the
Combo2 and use Instr function to find Item1 is there in the
inner text..if no Pass...If yes Fail.........


if the case is
the item selected in the combo2 should not be <item1>
then

get the selected item from the Combo2

strcomp("selected item","item1")

if yes fail
if no pass.

Is This Answer Correct ?    3 Yes 2 No

Hello! i am having two comboboxes.Each having 10 items in it.when i select first item in first com..

Answer / bfakruddin

We can do this in two ways...

1. Get all items from two combo boxes and store in two
separate arrays or in DataTable... "Your convenient process"

2. Validate one after the other dynamically in Loop...

I will keep one way here which I feel Logically better

2.

dim exp,act,cmb_1,cmb_2

cmb_1_cnt=browser("...").page("....").weblist
("...").getitemcount

for i=1 to cmb_1_cnt

exp=browser("...").page("...").weblist("...").getitem(i)

call cmb_2_Func()

reporter.reportevent micPass,"Test is Passed","Two
comboBoxes contain Different Items"

Next

Function cmb_2_Func()

cmb_2_cnt=browser("...").page("...").weblist
("...").getitemcount

for i=1 to cmb_2_cnt

act=browser("...").page("...").weblist("...").getitem

if (act=exp) then

reporter.reportevent micFail,"Test is Failed","Two
ComboBoxes contain Same Item"
End For

End if

Next

End Function

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More QTP Interview Questions

Whar are the challenges do we face while testing web based applications using the automation tool QTP or any??

0 Answers  


pls tell me different type of automation frame works in QTP and which one need to select in client server application

7 Answers   Syntel,


How can you find Local Host Name by Using QTP?

4 Answers  


What kind of errors can b handled in QTP in real time scenario?

2 Answers   AZTEC,


Explain the concept of object repository and how QTP recognizes objects?

0 Answers  






how to write code for to select all the checkboxs in the gmail i wrote code for my question but it didn't works any body suggest what wrong my code my code is Set chkboxDesc=Description.Create() chkboxDesc("type").value="chekbox" Set chboxcollection=Browser("name:=Gmail .*").Page("title:=Gmail .*").ChildObjects(chkboxDesc) For i=0 To chboxcollection.count-1 chboxcollection(i).set "ON" Next i was getting general run time error pls help me i am in learing stage

2 Answers  


I have a Webedit object. some text is entered in that object I want to know the font sixe of that text.How could I do this using QTP? This is a requirement for me. I am happy if any one help on this

3 Answers   GE,


what is bultin funtaion in QTP &tell me five examples?

5 Answers   Kanbay,


i need code for how to click on particular mail in utlook mail box .its urjent Thank You Balaji

0 Answers  


give the code to count child objects (Total) in the page

1 Answers  


What is smart identification?

2 Answers   AZTEC,


WHAT ARE THE DISADVANTAGES OF SHARED REPOSITORY?

9 Answers   BirlaSoft,


Categories