Hi All,<div><br></div><div>I have tried to transliterate the following C# code to IronPython:</div><div><br></div><div><div>using System;</div><div>using System.Collections.Generic;</div><div>using System.Linq;</div><div>using System.Text;</div>
<div>using System.Windows.Automation;</div><div><br></div><div>namespace ConsoleApplication1</div><div>{</div><div>    class Program</div><div>    {</div><div>        static void Main(string[] args)</div><div>        {</div>
<div>            AutomationElement eNode;</div><div>            eNode = TreeWalker.ControlViewWalker.GetFirstChild(AutomationElement.RootElement);</div><div>            while(eNode != null) {</div><div>                if (<a href="http://eNode.Current.Name">eNode.Current.Name</a> == &quot;Untitled - Notepad&quot;)</div>
<div>                {</div><div>                    AutomationElement ae;</div><div>                    ae = TreeWalker.ControlViewWalker.GetFirstChild(eNode);</div><div>                    System.Console.WriteLine(&quot;-------------------&quot;);</div>
<div>                    while (ae != null)</div><div>                    {</div><div>                        System.Console.WriteLine(&quot;Name: {0}&quot;, <a href="http://ae.Current.Name">ae.Current.Name</a>);</div><div>
                        ae = TreeWalker.ControlViewWalker.GetNextSibling( ae);</div><div>                    }</div><div>                    System.Console.WriteLine(&quot;-------------------&quot;);</div><div>                }</div>
<div>                eNode = TreeWalker.ControlViewWalker.GetNextSibling(eNode);</div><div>            }</div><div>        }</div><div>    }</div><div>}</div></div><div><br></div><div>The output of this program looks like:</div>
<div><br></div><div><div>-------------------</div><div>Name: test1</div><div>Name: Untitled - Notepad</div><div>Name: Application</div><div>-------------------</div></div><div><br></div><div>This is my IronPython code:</div>
<div><br></div><div><div>import clr</div><div><br></div><div>clr.AddReference(&#39;UIAutomationTypes&#39;)</div><div>clr.AddReference(&#39;UIAutomationProvider&#39;)</div><div>clr.AddReference(&#39;UIAutomationClient&#39;)</div>
<div><br></div><div>import System.Windows.Automation as swu</div><div><br></div><div>rae = swu.TreeWalker.ControlViewWalker.GetFirstChild( swu.AutomationElement.RootElement )</div><div>while rae:</div><div>    if <a href="http://rae.Current.Name">rae.Current.Name</a> == &#39;Untitled - Notepad&#39;:</div>
<div>        print &#39;-&#39;*24</div><div>        ae = swu.TreeWalker.ControlViewWalker.GetFirstChild( rae )</div><div>        while ae:</div><div>            print <a href="http://ae.Current.Name">ae.Current.Name</a></div>
<div>            ae = swu.TreeWalker.ControlViewWalker.GetNextSibling( ae )</div><div>        print &#39;-&#39;*24</div><div>    rae = swu.TreeWalker.ControlViewWalker.GetNextSibling( rae )</div></div><div><br></div><div>
The output of this shows:</div><div><div>------------------------</div><div>test1</div><div>------------------------</div></div><div><br></div><div>I read somewhere that IronPython used to have issues with UI Automation. Is still the case?</div>
<div><br></div><div>Regards,</div><div>Yngipy</div>