QTP -- SlvList("").GetItem(index) -- Not returning the values in the silver light list. (246 Views)
Reply
Occasional Advisor
NaveenVanapalli
Posts: 9
Registered: ‎12-04-2013
Message 1 of 4 (246 Views)

QTP -- SlvList("").GetItem(index) -- Not returning the values in the silver light list.

Hello,

 

From QTP Help:

 

Description

GetItem - Returns the value of the item specified by the index.

Syntax

object.GetItem (Index)

 

I am trying to get the list item using the 2nd statement where it is returning an empty value though i have 53 items in that list.

To get the items count in the list i have used the below statement which shows 53 as a count in the list.

rcCount = Browser("Browser").Page("Page").SlvWindow("SlvWindow").SlvDialog("Popup").SlvList("Selector").GetItemsCount
Msgbox rcCount 

 

rcCount = Browser("Browser").Page("Page").SlvWindow("SlvWindow").SlvDialog("Popup").SlvList("Selector").GetItem(2)
Msgbox rc

 

Please let me know if i am wrong in using the above statement.

 

Thanks,

Naveen

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 228
Registered: ‎08-06-2013
Message 2 of 4 (227 Views)

Re: QTP -- SlvList("").GetItem(index) -- Not returning the values in the silver light list

Hello,

 

Maybe there is another object within the list item? What is (the hierarchy) recorded/object-spied against this item?

If this is the case, you should consider getting a reference to this object first and then taking its value.

 

Regards,

Ana

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
Occasional Advisor
NaveenVanapalli
Posts: 9
Registered: ‎12-04-2013
Message 3 of 4 (222 Views)

Re: QTP -- SlvList("").GetItem(index) -- Not returning the values in the silver light list

Hello Ana,

 

Thanks for you comment.

To more clear for your reply i have given the my comments as below in bold font.

 

Maybe there is another object within the list item?

 

You are right, when i spy the items or elements in the SlvList QTP is identifying each element in the list as SlvObject in the Object Spy window. After identifying the object, when i am trying to highlight the SlvObject from Object Spy qtp is throwing error as "The selected object cannot be found in the application" but the SlvList and the elemets are still showing in the AUT.

 

What is (the hierarchy) recorded/object-spied against this item?

When i record the object below is the statment that display in the QTP test.

Browser("YYYYYY").Page("ZZZZZZZ").SlvWindow("MainPage").SlvDialog("Popup").SlvList("Selector").Select 4

 

If this is the case, you should consider getting a reference to this object first and then taking its value.

You mean that you want me to use obj.ChildObjects method to get the elements in the list.

 

Regards,

Naveen

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 228
Registered: ‎08-06-2013
Message 4 of 4 (182 Views)

Re: QTP -- SlvList("").GetItem(index) -- Not returning the values in the silver light list

Hello Naveen,

 

In case of SlvObjects within SlvList, you still should be able to retrieve the value of a list item with SlvList("").GetItem(index). I tested this with UFT 11.53 against the list view objects in following example: http://demo.componentone.com/silverlight/controlexplorer/#Accordion/See%20it%20in%20action

 

Are you able to successfully use GetItem against above sample AUT? Also, which version of QTP/UFT are you using?

Additionally, clarify the following:

- Is GetItem not returning the correct value for all the items in the list?

- Is highlight returning same error for all the items of the list?

- What is the result when you add the SlvObject in OR and then use it in script, for example:

...SlvList("").SlvObject("").GetROProperty("text")

- What are the test object properties of one of the problematic list items (from OR/Object Spy)

 

Regards,

Ana

 

 

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation