![]() |
|
How To Find Dropdown Object based on Values from the dropdown list - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/forum-3.html) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/forum-6.html) +--- Thread: How To Find Dropdown Object based on Values from the dropdown list (/thread-6363.html) Pages:
1
2
|
How To Find Dropdown Object based on Values from the dropdown list - mesg2anil - 05-18-2012 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 RE: How To Find Dropdown Object based on Values from the dropdown list - ravi.gajul - 05-21-2012 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 ; RE: How To Find Dropdown Object based on Values from the dropdown list - mesg2anil - 05-21-2012 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 RE: How To Find Dropdown Object based on Values from the dropdown list - ravi.gajul - 05-21-2012 Hi Anil, Yeah for us to acheive this, we may try as shown below Code: 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 IFRegards, Ravi RE: How To Find Dropdown Object based on Values from the dropdown list - mesg2anil - 05-21-2012 Hi Ravi, Thanks a lot for the help... it is working... just did a small change as below Code: allitems = Browser("Browser").Page("Real Estate Enterprise").Frame("ContentFrame_2").WebList("cboPLC").GetROProperty("all items")instead of page, gave the path till object as I'm looking for object property values. Thanks once again!! ![]() Regards, Anil RE: How To Find Dropdown Object based on Values from the dropdown list - Neetha - 07-30-2015 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. RE: How To Find Dropdown Object based on Values from the dropdown list - kotaramamohana - 08-11-2015 Hi Neetha, Here is code for your Question Code: allitems = split(browser().page().WebList().getRoProperty("all items"), ";")
for each x in allitems
if instr(x, "100") > 0 Then
browser().page().WebList().select x
strFound = True
Exit For
next
if strFound = True Then
msgbox "I tem is listed in the list box and selected"
Else
msgbox "Item is not listed in the list box"
end ifRE: How To Find Dropdown Object based on Values from the dropdown list - Vijay Kumar - 10-18-2016 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 RE: How To Find Dropdown Object based on Values from the dropdown list - supputuri - 10-29-2016 Other simple way is to provide the xpath till the option and then click. Code: Browser("Browser").Page("Page1").WebElement("xpath:=//selct[@id="your list box id"]/option[contains(.,'list item')]").clickRE: How To Find Dropdown Object based on Values from the dropdown list - prajyot - 03-08-2017 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 |