Forum Discussion

Divya-tfw's avatar
Divya-tfw
New Contributor
8 years ago

How to fetch element property values from list

Hi ,

I have a scenario where in I have to validate the elements present in table using python in TestComplete , but when I inspected that element .Its a list item.Hence I am not getting any proper info on how to get elements from list.I tried in following ways but failed:

1. Added elements of list to a table but no option available to fetch elements from table
2.Trying to fetch elements from list , but its not working .

 

Find the attachment referring to table and its properties

Help on above would be grate.

Thanks in advance.

7 Replies

  • I don't think you can examine elements of a Python list object in Debug view. I have never been able to do that, somewhat inconvenient. Fortunately Object Spy is very cool.

     

    Looks like a ListView object you've got there. To see what is in there I would suggest first going to "Advanced View" in object spy. Point at your listview object like you have already done in your screen shot. Go to "Items" under .NET in Advanced View Object Spy. Go  click on the "...", type in an item index (like 0) and start drilling down into the item hierarchy. Once you can drill down into the listview to the items in Object Spy, copy the full path at the top and start playing with that in script.

     

    Eventually you should be able access the items from script like this...

     

    Aliases.TestAppBlah.blahForm.blah1.blah2.listView1.Items.Item[0]

     

    ^You'll probably want to find something less brittle than a numerical index but that should get you started.

     

    Hope that helps.