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.
07-19-2012, 05:14 PM (This post was last modified: 07-19-2012, 05:15 PM by Ankesh.)
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
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..
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.
07-23-2012, 09:04 AM (This post was last modified: 07-23-2012, 09:07 AM by CosmaShiva.)
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...
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.