Thursday 20 February 2014

How to find all items from the weblist in QTP?

Below example illustrates how We can get the all items from the drop down in QTP.

arrWeblistItems = split(objParent.weblist("name:=listType").GetROProperty("all items"),";")

'print total number of items in the listbox
print arrWeblistItems.count

For itemCounter =0 to ubound(arrWeblistItems)
'print the value in the dropdown
print arrWeblistItems(itemCounter )
Next                                                

This is how we can print the all items in the list box in QTP.

We can also get all items in the combo box using HTML DOM + QTP as shown in below code.

Set col = ObjParent.weblist("name:=tranType").object.getElementsByTagName("option")
For i=0 to col.length-1
              'print the value in each option inside combobox
             print col(i).innerText
Next


Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts. You can write to me at reply2sagar@gmail.com

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.