Forum Discussion
Tree View object has a property called Expended/wExpended using this you can do like below,
if(Aliases.App.win_MainWindow.treeView.WaitProperty("Expended or wExpended",true,10000)){ Log.Message("Tree view loaded"); }
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
- AlexKaras7 years agoChampion Level 3
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.
- tristaanogre7 years agoEsteemed ContributorI have a general question as to what you're trying to achieve. It appears, from your example of
|Desktop|Network|PC111111|LIS Folders|Lis_Import
that you're trying to navigate Windows Explorer to get to a particular folder. Is that correct?
If so... to what end? Are you distinctly needing to test some aspect of navigating the File Explorer and expanding tree nodes? Or do you simply need to navigate to the desired folder and perform some action?
If you just need to navigate, many dialogs and such involving file navigation have the ability for you to simply enter the path. For example, to get to the above path, you could just navigate to
\\PC111111\LIS Folders\Lis_Import
Is this a valid work around? Or do you distinctly need to test the treeview navigation?- endorium7 years agoFrequent Contributor
The purpose is to navigate within a piece of medical software we make in house.
We need to select certain folders for files ot be picked up from.
You click a button and it brings up a treeview and a treeview only.
If your selecting a local location its not an issue as it expands instantly.
If selecting a network drive clicking on Network can take a while to expand.
The PCname and location can be varied. In our test scripts we specificy the button to click and the location we need selecting as the folder location.
Just need a way of waiting for the tree to expand so it does not fail when selecting a network location.
If I pass in |Desktop|Network|PC11111
Would I need the function to split the passed in location into chunks and expand each one at a time with a wait as suggested above?
If so any help starting this would be appreciated. Its one of those things that seemed simple but to make it generic and work in all the instances we use it has turned a bit more complex.
- tristaanogre7 years agoEsteemed Contributor
OK, then... next question... is it a requirement to test navigating to and picking up from a network location? If what you're running into is not a problem with a local drive, can you satisfy the requirements of your test by using a local drive?
What I'm getting at is this: that sometimes the trouble to automate something is not worth the return. So, if there is no specific need to navigate to the network drive, you can achieve the same test results by substituting a local drive. I know this doesn't solve the specifics of your problem. I'm just trying to offer a different perspective on what you're trying to solve.
Related Content
- 2 years ago
- 14 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 6 days ago