GetLastChild() public méthode

public GetLastChild ( AutomationElement element ) : AutomationElement
element AutomationElement
Résultat AutomationElement
 public void TreeIterationTest()
 {
     TreeWalker walker = new TreeWalker(Automation.ControlViewCondition);
     AutomationElement startingElement = ExplorerTargetTests.explorerHost.Element;
     AutomationElement iter = startingElement;
     iter = walker.GetFirstChild(iter);
     iter = walker.GetNextSibling(iter);
     iter = walker.GetParent(iter);
     Assert.AreEqual(startingElement, iter);
     iter = walker.GetLastChild(iter);
     iter = walker.GetPreviousSibling(iter);
     iter = walker.GetParent(iter);
     Assert.AreEqual(startingElement, iter);
 }
Exemple #2
0
		public void GetLastChildTest ()
		{
			Condition buttonCondition = new PropertyCondition (AEIds.ControlTypeProperty, ControlType.Button);
			TreeWalker buttonWalker = new TreeWalker (buttonCondition);

			AssertRaises<ArgumentNullException> (
				() => buttonWalker.GetLastChild (null),
				"passing null to TreeWalker.GetLastChild");

			VerifyGetLastChild (buttonWalker, groupBox1Element, button2Element);
		}
        protected void GetAutomationElementsChildren(AutomationElement inputObject, bool firstChild)
        {
            if (!this.CheckControl(this)) { return; }

            System.Windows.Automation.TreeWalker walker =
                new System.Windows.Automation.TreeWalker(
                    System.Windows.Automation.Condition.TrueCondition);

            AutomationElement sibling = null;
            if (firstChild) {
                // 20120824
                //sibling = walker.GetFirstChild(this.InputObject);
                sibling = walker.GetFirstChild(inputObject);
            } else {
                // 20120824
                //sibling = walker.GetLastChild(this.InputObject);
                sibling = walker.GetLastChild(inputObject);
            }
            WriteObject(this, sibling);
        }
Exemple #4
0
		private void VerifyGetLastChild (TreeWalker tree, AutomationElement rootElement, AutomationElement expectedElement)
		{
			AutomationElement actualChild = tree.GetLastChild (rootElement);
			Assert.AreEqual (expectedElement, actualChild,
				String.Format ("GetLastChild with root element named {0}: Expected element named {1}, got element named {2}",
				GetName (rootElement), GetName (expectedElement), GetName (actualChild)));
			if (expectedElement != null)
				Assert.AreNotSame (expectedElement, actualChild, "GetLastChild returns a new instance");
		}