Micro Focus QTP (UFT) Forums
Unable to identify an item in a combobox - 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-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Unable to identify an item in a combobox (/Thread-Unable-to-identify-an-item-in-a-combobox)



Unable to identify an item in a combobox - katlu - 09-25-2008

Hai,
I have a combo box and have to choose an item from the list of items displaying. I have my description as mentioned below. I basically achieve this by clicking on back on the webedit box and the entire list of items gets displayed in a drop down format. I give the no. of times down arrow key has to be pressed. This is how my code is, but its very inconsistent that the correct item is picked so Im trying description as below but i get object not found error.

Code:
Browser("Login").Page("Login").Image("Search_XPSilver").FireEvent "onmouseover"
Browser("Login").Page("Login").Image("Search_XPSilver").Click

Set oDesc = Description.Create()
oDesc("micclass").value = "WebElement"
oDesc("class").value = "ctl00MainContentctl00ActiveWidgetctl451-LayoutSettings-ColumnStyle"
oDesc("innertext").value = "Accountant 1"

I attached the s.shot of the obj spy.


RE: Unable to identify an item in a combobox - Sonia - 09-26-2008

Hi , Try this

1. include the list item in your OR and then do Webelement("item").Click to select that item .. This is because you will find that the list items are also Webelements

2. OR try this

Webelement ("innertext:= item" , " index:= 0")

item is the name of the item on the list and index should be filled depending on the item that you need , either 0 or 1 or 2

Sonia


RE: Unable to identify an item in a combobox - katlu - 09-27-2008

Hai Sonia,
Thanks a lot for your reply...
I had tried both your ways before giving a dynamic description... Couldnt get thru... Just so you know, I could get thru sparingly say 40% of the time.. i want to make it consistent. If you think of any answers pls let me know. Thanks again for taking time to reply.