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

Tags:

Parents
  • 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

  • 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

  • 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 it in action

     

    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

     

     

Reply
  • 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 it in action

     

    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

     

     

Children