Posts: 3
Threads: 1
Joined: May 2012
Reputation:
0
05-18-2012, 06:29 PM
Hi,
I'm having difficulty scripting for below situation...
I have a dropdown list, in the dropdown list I've values as below...
one
two
three
four
five
I want to find the dropdown object exists or not based on the dropdown list values as shown above. How to find the object? Please help!!
Regards,
Anil
Posts: 257
Threads: 10
Joined: Oct 2011
Reputation:
2
05-21-2012, 12:11 AM
Please use getRoProperty("allitems") to achieve this. allitems is a property for a list object that holds all the drop down items seperated by a delimiter say ;
Posts: 3
Threads: 1
Joined: May 2012
Reputation:
0
05-21-2012, 10:59 AM
Thanks Ravi for replying.
I tried this option getRoProperty("all items"), but my need is, not just to get all the items, I want to search one particular item from combo box, if that item exist then I want to perform an action else other action. I want to seach instead of getting items...
Please suggest
Thanks, Anil
Posts: 13
Threads: 5
Joined: Jul 2015
Reputation:
0
07-30-2015, 08:15 AM
Hi,
I am having a similar kind of issue as you are discussing. I want to search for an option in the drop down that has a specific string and select it.
Ex. If my drop down is having these options
100 Hyderabad
100 Secunderabad
200 Vijayawada
200 Tirupati
300 Chennai
And I want to look for the option that has this partial text "100" and select it. It can be any of the first two options. How do I achieve this using QTP? Please help.
Thanks.
Posts: 3
Threads: 0
Joined: Oct 2016
Reputation:
0
10-18-2016, 07:23 PM
(This post was last modified: 10-18-2016, 07:24 PM by Vijay Kumar.)
ExpectedResult="London"
'allitems=Window("Flight Reservation").WinComboBox("Fly From:").GetROProperty("all items:=DenverFrankfurtLondonLosAngelesParisPortlandSan FranciscoSeattleSydneyZurich")
Itemscount=Window("Flight Reservation").WinComboBox("Fly From:").GetROProperty("all items")
MsgBox Itemscount
result=Split(Itemscount,";")
For i = 0 To UBound(result)
currentitem=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
MsgBox currentitem
If currentitem=ExpectedResult Then
MsgBox "expected item exists in WebList"
else
MsgBox "expected item Not exists in WebList"
Window("Flight Reservation").WinComboBox("Fly From:").Select ExpectedResult
Exit for
End If
Next
Posts: 3
Threads: 1
Joined: May 2016
Reputation:
0
03-08-2017, 12:41 PM
allitems=browser().page().WebList().getRoProperty("allitems")
IF instr(allitems,"one")<>0 Then 'where "one" is an item you are looking for
'perform the action you want to
End IF