Checking if an item is not available from TreeView
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Checking if an item is not available from TreeView
I would like to delete an item from TreeView control and check this item is no longer available in the treeview. 'ClickItem' posts error in test log and 'Exists' seem doesn't work. How to best do this in TestComplete? Is there another method that I can use?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using NameMapping, try calling
Aliases.RefreshMappingInfo(); before you test for Exists
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably I should have mentioned that 'Exists' is not available as one of the property/method for TreeView control.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are there properties such as Visible or VisibleOnScreen you could try?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would the wItemCount become one less? I see that is obsolete - maybe the number of wItems returned would be one less?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
best solution would be use this script and make a text file before you deleting.
and create another after delet and compare them
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Text file option is probably the best option for me.
I think wItems method should work too but I find this being less suitable for our treeview which has many levels of children.
Thanks to everyone for helping me out. Really appreciate all your help.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Delete the node.
Refresh object properties.
Try selecting the node you just deleted.
Refresh again.
Check the current selection (it should be a property of the tree).
If it's not the one you just deleted, the deletion worked. (Unless it just moved it. If you want to be that sure, you'd need to do a node count or iterate through checking them.)
Thats how I do it with Delphi TreeViews. Works fine as tryting to select a node that doesn't exist doesn't cause it to throw and error for me. And even if it did, a simple try/catch should take care of it.
