VSTS-CUIT: nodes attribute of wintreeitem and getchildren () method

Source: Internet
Author: User

As shown in, in Windows Explorer, the left sidebar is a wintree, and each node is an independent wintreeitem, such as system (C :), CDE, Dell, and so on.

 

It seems that CDE, Dell Is the child node of system (C :). However, when we use the coded UI test builder to traverse its hierarchy, we find that they are not a parent-child relationship, but a sibling relationship. That is to say, after obtaining the wintreeitem System (C :), call its getchildren () method, and the number of child nodes is empty.

 

However, if we call its nodes attribute, we can obtain the set of Child Nodes Displayed by it.

 

CodeExample:

wintreeitem driverc = new wintreeitem (winexplorer ); <br/> driverc. searchproperties. add ("name", "system (C :)"); </P> <p> uitestcontrolcollection nodes = driverc. nodes; </P> <p> foreach (uitestcontrol node in nodes) <br/>{< br/> wintreeitem item = node as wintreeitem; <br/> If (item! = NULL) <br/>{< br/> item. expand = true; <br/> If (item. name = "CDE") <br/>{< br/> mouse. click (item); <br/> break; <br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.