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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How can i initiate the objects to find uniquely in OR

1552


HOw to add the recovery file at runtime to the test file .

1635


Can you list some technologies that support qtp?

634


in a web page How to check and display a particular word from a paragraph?

2145


what are all the fileds present in object repository?

1647






How to give a call to another action from one action?

709


How to use reporter.report event in qtp ?

650


Hi, my requirement is to make a query in SQL using QTP. And i have to get the results of that query and i have to use those results for future testing. I created a driver but i dont know the code for using this Driver. please help me by providing the solution for y requorement

1736


What is fragmentation and paging?

1672


How to run an integrated test scenario using Multiple Actions? How to use the QTP Step Generator?

3557


how could i download qtp in which i get add-in support for 'oracle' is there any way to get it? i finding but not getting pls help me out :)

1527


wt is the use of multiple questions in QTP

1776


How can you pass value one action to another action?

644


What is 'sleep' in sync point?

713


This is a question thats generally asked in every QTP interview. What were the problems that you faced during automation and how did you resolve them?

1554