Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to select items from WebLists
#1
Not Solved
Howdy,
I am automating a Web based app.
I have many WebLists.
When each WebList is clicked a list of elements is displayed.
However...weblist().Select() does not work.
Select returns an error that the required element canot be located.
QTP (including Object Spy) can only see the currently displayed element.
AllItems for the WebList does not include all the elements - only the one currently displayed.
When recording I can display the list of elements and use the down key to navigate to the required element - but the resulting code still shows the action as a SELECT.
Can anyone assist me with a way to access the dropdown element even though QTP does not recognise them.
Cheers and thanks,
Simon.
Reply
#2
Not Solved
Hi,

Can you pls provide the snap shot of your screen u are working on and object spy.

Regards,
K
Reply
#3
Not Solved
Screenshots attached
hope this assists - thanks for your time
Simon


Attached Files
.doc   UnableToSelectWebListElements.doc (Size: 585.5 KB / Downloads: 152)
Reply
#4
Not Solved
Can you just use the below function to see if this is working for you.


Code:
Function SelectWebListValue(strValue, strObjectName)

'Get the total no of items in that dropdown
intItemsCount=Browser("").Page("").Frame("").WebList(strObjectName).GetROProperty("items count")
'Browser("").Page("").Frame("").WebList(strObjectName).Highlight
For intIndex = 1 To intItemsCount
    strTextFrmAppl=Browser("").Page("").Frame("").WebList(strObjectName).GetItem(intIndex)
    
    If strTextFrmAppl= strValue Then
        Browser("").Page("").Frame("").WebList(strObjectName).Select strValue
        Reporter.ReportEvent micPass,"Weblist selection","Given value ("& strValue &") selected"
        SelectWebListValue= True
        Exit For
    ElseIf intIndex=intItemsCount Then
        Reporter.ReportEvent micFail,"Weblist selection","Given value ("& strValue &") is not present"
        SelectWebListValue= False

    End If
Next

End Function

To call the function use the below code

Call SelectWebListValue("Your Value","WeblistObject")

Regards,
Ankesh

Remove frame from the function if it is not there in your object hierarchy.
Reply
#5
Not Solved
Howdy Ankesh,
Thanks for your response, but unfortunately this did not resolve my issue.
I've attached screen shots...

I feel that what I need to do is capture the object that displays the elements when I click on the dropdown button, and then interact with that object - just not sure how to get there...

Of course i may be barking up the wrong tree all together..

Cheers and thanks,

Simon.


Attached Files
.doc   SelectWebListValue_FunctionTest.doc (Size: 351 KB / Downloads: 113)
Reply
#6
Not Solved
Hi Simon,

Can you please tell me that in "Customer Type" weblist, the combo box and downArrow key associated with it are to diifferent components or the same, i.e. when you SPY, you are able to capture these two elements differently or not.
Do try again to check the above mentioned things.

Regards,
K
Reply
#7
Not Solved
did you debug the function? Are you able to get the values for strTextFrmAppl and intItemsCount variable? Chk it once and let me know the result.

Meanwhile you can also look a the properties of the weblist.

Browser("").Page("").WebList("").Object.<a list of properties will appear> '' Chk the properties and see if you could use any of them.


Regards,
Ankesh
Reply
#8
Not Solved
Howdy,

The combobox and button are seen as one control only.
Only one object is seen by QTP - ie: the WebList control.
It does not see a button and a separet edit control

Cheers,

Simon.

Howdy Ankesh,

Yes I did debug. The issue seems to be that "allitems" only has the item currently displayed. When you change the current value of the weblist "allitems' changes the the new element displayed - with no others.

i'm still thinking that I need to try to capture the popup list of element and work with that..but not sure how...

Cheers,

simon.
Reply
#9
Not Solved
Hi,

Can you try some of the below.

1. Try focusing on the weblist and then .type method for 11, 12, 13 etc. if you know in advance which one to choose.
2. Focus on the web list object and try sendkeys method.

Let us know how it goes.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to select value from Weblist using QTP neenumaria 4 13,136 08-07-2018, 04:43 PM
Last Post: NovGirl
Rolleyes To Get number of menu items of a winmenu object sasmitakumari 0 6,368 07-08-2010, 02:56 PM
Last Post: sasmitakumari
  Create List of all menu items LGold 1 2,513 04-29-2009, 03:37 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 1 Guest(s)