How to check if item is not available in treeview
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2009
04:10 AM
11-25-2009
04:10 AM
How to check if item is not available in treeview
Hi, I am evaluating TestComplete 7 and I am stuck on getting TestComplete to check if an item exist in treeview.
For Example: I have a treeview with a parent node A and there is a child under A called Test and under Test there is a child item call Item1 & Item2. If I delete Item2 how can I verify that Item2 is no longer in treeview?
I have the following written in Jscript but it does not work.
if ( ! treeview.wItems.Item("A|Test|Item2").Exists)
Log.Message("Item2 does not exist in treeview")
else
Log.Message("Item2 does exist in treeview")
Please Help!
Thanks
Kathy
For Example: I have a treeview with a parent node A and there is a child under A called Test and under Test there is a child item call Item1 & Item2. If I delete Item2 how can I verify that Item2 is no longer in treeview?
I have the following written in Jscript but it does not work.
if ( ! treeview.wItems.Item("A|Test|Item2").Exists)
Log.Message("Item2 does not exist in treeview")
else
Log.Message("Item2 does exist in treeview")
Please Help!
Thanks
Kathy
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2009
11:28 PM
11-25-2009
11:28 PM
Hi Kathy,
See my reply here:
http://www.sqaforums.com/showflat.php?Cat=0&Number=603184&page=0&vc=&PHPSESSID=#Post603184
See my reply here:
http://www.sqaforums.com/showflat.php?Cat=0&Number=603184&page=0&vc=&PHPSESSID=#Post603184
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2019
01:08 AM
03-03-2019
01:08 AM
Can't open the link. Can you please share again ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2019
11:55 PM
03-03-2019
11:55 PM
Hi @M-H-Mukit,
You can find Yuri's reply from the mentioned topic below.
However, I would like to draw your attention that this topic is very old. TestComplete has been improved significantly since that time. I suggest that you create your own topic here and describe what you would like to achieve.
Yuri's reply:
Hi,
You can use code like this:
function treeItemExists(tree, itemPath) { var items = itemPath.split("|"); var treeItems = tree.wItems; var found = false; for(var item in items) { found = false; if(!treeItems) break; for(var i = 0; i < treeItems.Count; i++) { if(treeItems.Item(i).Text == items[item]) { found = true; treeItems = treeItems.Item(i).Items; break; } } } return found; } ... var tree = // Obtain the tree view if(!treeItemExists(tree, "Shipowners|A1|Chemical")) Log.Message("Item does not exist in treeview") else Log.Message("Item exist therefore delete of item was not successful") ...
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager
Tanya Yatskovskaya
SmartBear Community and Education Manager
