Forum Discussion
Thanks for the reply.
So I have the below:
"treeViewAlias.ExpandItem(folderPath, 30000);
treeViewAlias.ClickItem(folderPath)
Log["Message"]("Folder " + folderPath + " was selected.");"
But it does not wait 30 seconds for it to expand and instead fails. The issue is that it can expand Desktop straight away. Its expanding Network that takes time. Instead of waiting for it then expanding it, it just fails as it cannot see pc11111 until network is expanded.
|Desktop|Network|PC111111|LIS Folders|Lis_Import
Hi,
Generic .ExpandItem() method has no idea what to wait for in this or that case and what are the criteria that must be met to consider an item to be (successfully) expanded.
Thus, instead of expanding the sequence of items, you should expand them one by one and wait until every given item is expanded. (Consider this extension of your sample: What test code must do if you try to expand the Network item with no network connection available? Extension 2: What to do if pc11111 is turned off?)
P.S. Considering your example: unless visual selection in the tree is the only possible method to select the needed folder and unless you are testing this given treeview, it is usually more reliable and performant to provide the path (e.g. \\PC111111\LIS Folders\Lis_Import) then to select the path visually.
Related Content
- 2 years ago
- 14 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 6 days ago