<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Musings about os development , assembly language , game development , compiler development , software testing  and software engineering</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/samathew/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/samathew/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:41:31 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Lessons I learned in Software Testing</title>
      <link>https://docs.microsoft.com/archive/blogs/samathew/lessons-i-learned-in-software-testing</link>
      <pubDate>Wed, 04 Nov 2009 01:23:35 GMT</pubDate>
      <dc:creator><![CDATA[SandeepMathew]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samathew/2009/11/04/lessons-i-learned-in-software-testing/</guid>
      <description><![CDATA[Writing a good test case requires pragmatism and skill . I am not claiming that I am a good tester...]]></description>
      <content:encoded><![CDATA[<p>Writing a good test case requires pragmatism and skill . I am not claiming that I am a good tester yet , but I made many mistakes . These are some of the mistakes I made which helped me learn a lot about software . A test engineers job actually requires both technical and political skills . Although political skill are not taken into consideration they are quite important . Developers tend to believe that they have done everything correctly and since they wrote the original code , it is quite difficult to obtain the same about knowledge about the code as they have . You will have a hard time convincing people&nbsp; “ your point of view “ . One of the biggest mistakes I made was to try the edge scenarios first than the primary ones . Although it seems easy at first , it requires some attention and focus to execute . We should and must execute the primary scenarios first than the edge scenarios . </p> <p>Some documentation is always better than no documentation at all . It is better to have a precise document explaining what is to be done even before the test execution begins . Another challenge is to execute the documented steps in a meticulous manner so that you can reproduce and track the bugs accurately . Once you find the bug&nbsp; it is very important to describe the bug in a proper manner . That requires good communication skill both written and verbal . </p> <p>Test automation saves time and I believe whatever that can be automated within the time allocated should be automated , well written automation scripts save time and reduce frustration . The challenge with automation is that it&nbsp; quite impossible to inject a&nbsp; human brain into a computer program . There are certain things humans do well than computers without much difficulty . You might face issues with timing and synchronization. It is ideal to do automation when UI and features are quite stabilized otherwise&nbsp; we may need to change our code pretty often and waste a lot of time where we could have used that time for testing the software / product under consideration . </p> <p>Gaining respect as a tester is also quite challenging , test requires a different sort of skill , not everyone is gifted with that kind of skill ( I myself is pretty bad in this respect ) . But&nbsp; I believe all skills can be mastered with hard work and patience&nbsp; . Tester’s generally do not have deep granular level&nbsp; knowledge of the product as that of a developer , but they know how things are supposed to work . Developers consider therefore testers as “less technical “ mortals . But the real world fact is that technically superior products may not be very successful in the market . I am developer myself by heart&nbsp; and have developed compilers , operating systems , games , emulators , graphics libraries and so forth&nbsp; ( I am a MCPD too&nbsp; :) )&nbsp; , I believe my experience as a tester will make me a better developer . The path I am trying to pursue is to gain more knowledge and improve my communication skill so that I can gain more respect .</p> <p>&nbsp;</p> <p>I aspire to be an awesome developer and testing is an integral part of development&nbsp; . That’s all for now , more musings at a later point of time&nbsp; </p>]]></content:encoded>
    </item>
    <item>
      <title>Automation With Windows UI Automation</title>
      <link>https://docs.microsoft.com/archive/blogs/samathew/automation-with-windows-ui-automation</link>
      <pubDate>Mon, 02 Nov 2009 22:24:00 GMT</pubDate>
      <dc:creator><![CDATA[SandeepMathew]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/samathew/2009/11/02/automation-with-windows-ui-automation/</guid>
      <description><![CDATA[UIA shipped with .Net 3.0 did not receive the attention it really deserves . UIA can be used to...]]></description>
      <content:encoded><![CDATA[<p>UIA shipped with .Net 3.0 did not receive the attention it really deserves . UIA can be used to automate native windows applications , WPF applications as well as Silverlight applications . There are two things one must consider when automating </p> <ol> <li>Reference to the Automation Element  <li>The user pattern to be invoked&nbsp; </li></ol> <p>That's all . The AutomationElement.RootElement represents the desktop , all other UI elements are children of the desktop . We need to search the tree to find the required automation element . The tree hierarchy can be found by a tool called UISpy that comes as a part of Windows SDK . Then we need to determine what pattern is&nbsp; to be used , eg&nbsp; combobox uses&nbsp; ExpandCollapse Pattern , textbox uses TextPattern and&nbsp; button uses&nbsp; Invoke pattern . (MSDN has all information ) </p> <p>Lets see how its done using 2 simple automation actions&nbsp;&nbsp; </p> <p>Action&nbsp; 1 : Opening notepad and&nbsp; putting some junk text in it&nbsp; </p> <table border="10" cellspacing="0" cellpadding="2" width="700"> <tbody> <tr> <td valign="top" width="700"><pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Linq;
<span class="kwrd">using</span> System.Text;
<span class="kwrd">using</span> System.Diagnostics;
<span class="kwrd">using</span> System.Windows.Automation;
<span class="kwrd">using</span> System.Windows.Automation.Provider;
<span class="kwrd">using</span> System.Windows.Automation.Text;
<span class="kwrd">using</span> System.Windows.Forms;
<span class="kwrd">namespace</span> AutomateNotepad
{
    <span class="kwrd">class</span> Program
    {
        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            <span class="rem">// Make sure that all notepad process are killed</span>

            Process[] notepadProcceses = Process.GetProcessesByName(<span class="str">"notepad"</span>);
            <span class="kwrd">foreach</span> (Process notepadProc <span class="kwrd">in</span> notepadProcceses)
            {
                notepadProc.Kill(); 
            }
            <span class="rem">// Start a notepad window  </span>
            Process notepadProcces = Process.Start(<span class="str">"notepad"</span>); 
            <span class="rem">// Get the reference to the notepad window</span>
            AutomationElement notepadWindow = AutomationElement.RootElement.FindFirst(TreeScope.Descendants , <span class="kwrd">new</span> PropertyCondition(AutomationElement.ClassNameProperty,<span class="str">"Notepad"</span>)) ; 
            <span class="rem">// Get the reference to the notepad text box</span>
            AutomationElement notepadTextBox = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.ClassNameProperty, <span class="str">"Edit"</span>));
            TextPattern putText = notepadTextBox.GetCurrentPattern(TextPattern.Pattern) <span class="kwrd">as</span> TextPattern;
            putText.DocumentRange.Select();
            SendKeys.SendWait(<span class="str">" You  there ! why are you  looking at me !"</span>);
            Console.ReadKey(); 
        }
    }
}
</pre></td></tr></tbody></table>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p mce_keep="true">Action 2 : Walk through all the elements in a Silverlight page </p>
<p mce_keep="true">The&nbsp; XAML file of the Silverlight page is&nbsp; as follows </p>
<p mce_keep="true">&nbsp;</p>
<table border="10" cellspacing="0" cellpadding="2" width="700">
<tbody>
<tr>
<td valign="top" width="700"><pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">UserControl</span> <span class="attr">x:Class</span><span class="kwrd">="SilverlightTestPage.Page"</span>
    <span class="attr">xmlns</span><span class="kwrd">="https://schemas.microsoft.com/winfx/2006/xaml/presentation"</span> 
    <span class="attr">xmlns:x</span><span class="kwrd">="https://schemas.microsoft.com/winfx/2006/xaml"</span> 
    <span class="attr">Width</span><span class="kwrd">="400"</span> <span class="attr">Height</span><span class="kwrd">="300"</span> <span class="attr">xmlns:System</span><span class="kwrd">="clr-namespace:System;assembly=mscorlib"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Grid</span> <span class="attr">x:Name</span><span class="kwrd">="LayoutRoot"</span> <span class="attr">Background</span><span class="kwrd">="White"</span><span class="kwrd">&gt;</span>

     <span class="kwrd">&lt;</span><span class="html">Rectangle</span> <span class="attr">Height</span><span class="kwrd">="51"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span> <span class="attr">Fill</span><span class="kwrd">="#FF0F36E2"</span> <span class="attr">Stroke</span><span class="kwrd">="#FF000000"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">Rectangle</span> <span class="attr">Height</span><span class="kwrd">="2"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Right"</span> <span class="attr">Margin</span><span class="kwrd">="0,0,8,0"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Bottom"</span> <span class="attr">Width</span><span class="kwrd">="0"</span> <span class="attr">Fill</span><span class="kwrd">="#FF0F36E2"</span> <span class="attr">Stroke</span><span class="kwrd">="#FF000000"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Height</span><span class="kwrd">="32"</span> <span class="attr">Margin</span><span class="kwrd">="53,8,126,0"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span> <span class="attr">Text</span><span class="kwrd">="Automation Demo"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">Grid</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="0,51,0,0"</span> <span class="attr">Width</span><span class="kwrd">="80"</span> <span class="attr">Background</span><span class="kwrd">="#FF904F4F"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">Button</span> <span class="attr">x:Name</span><span class="kwrd">="myButton1"</span> <span class="attr">Background</span><span class="kwrd">="#FF339529"</span> <span class="attr">Height</span><span class="kwrd">="40"</span> <span class="attr">Margin</span><span class="kwrd">="8,27,8,0"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span> <span class="attr">Content</span><span class="kwrd">="Click Me "</span> <span class="attr">Click</span><span class="kwrd">="myButton1_Click"</span><span class="kwrd">&gt;</span>
       <span class="kwrd">&lt;</span><span class="html">Button.BorderBrush</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">LinearGradientBrush</span> <span class="attr">EndPoint</span><span class="kwrd">="0.5,1"</span> <span class="attr">StartPoint</span><span class="kwrd">="0.5,0"</span><span class="kwrd">&gt;</span>
         <span class="kwrd">&lt;</span><span class="html">GradientStop</span> <span class="attr">Color</span><span class="kwrd">="#FFA3AEB9"</span><span class="kwrd">/&gt;</span>
         <span class="kwrd">&lt;</span><span class="html">GradientStop</span> <span class="attr">Color</span><span class="kwrd">="#FF8399A9"</span> <span class="attr">Offset</span><span class="kwrd">="0.375"</span><span class="kwrd">/&gt;</span>
         <span class="kwrd">&lt;</span><span class="html">GradientStop</span> <span class="attr">Color</span><span class="kwrd">="#FF718597"</span> <span class="attr">Offset</span><span class="kwrd">="0.375"</span><span class="kwrd">/&gt;</span>
         <span class="kwrd">&lt;</span><span class="html">GradientStop</span> <span class="attr">Color</span><span class="kwrd">="#FF4DACF3"</span> <span class="attr">Offset</span><span class="kwrd">="1"</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">LinearGradientBrush</span><span class="kwrd">&gt;</span>
       <span class="kwrd">&lt;/</span><span class="html">Button.BorderBrush</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">Button</span><span class="kwrd">&gt;</span>
     <span class="kwrd">&lt;/</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="0,134,0,147"</span> <span class="attr">Width</span><span class="kwrd">="80"</span> <span class="attr">Text</span><span class="kwrd">="ComboBox1"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">ComboBox</span> <span class="attr">x:Name</span><span class="kwrd">="myCombo1"</span>   <span class="attr">Height</span><span class="kwrd">="19"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="0,0,0,114"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Bottom"</span> <span class="attr">Width</span><span class="kwrd">="72"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">System:String</span><span class="kwrd">&gt;</span>String1<span class="kwrd">&lt;/</span><span class="html">System:String</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">System:String</span><span class="kwrd">&gt;</span>String2<span class="kwrd">&lt;/</span><span class="html">System:String</span><span class="kwrd">&gt;</span>
     <span class="kwrd">&lt;/</span><span class="html">ComboBox</span><span class="kwrd">&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">CheckBox</span> <span class="attr">x:Name</span><span class="kwrd">="myCheck1"</span> <span class="attr">Height</span><span class="kwrd">="19"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="8,0,0,61"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Bottom"</span> <span class="attr">Width</span><span class="kwrd">="20"</span> <span class="attr">Content</span><span class="kwrd">="CheckBox"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Height</span><span class="kwrd">="26"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="0,0,0,84"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Bottom"</span> <span class="attr">Width</span><span class="kwrd">="72"</span> <span class="attr">Text</span><span class="kwrd">="Checkbox1"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">RadioButton</span> <span class="attr">x:Name</span><span class="kwrd">="myRadio1"</span> <span class="attr">Height</span><span class="kwrd">="15"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="112,91,0,0"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span> <span class="attr">Width</span><span class="kwrd">="17"</span> <span class="attr">Content</span><span class="kwrd">="RadioButton"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Height</span><span class="kwrd">="21"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="93,66,0,0"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span> <span class="attr">Width</span><span class="kwrd">="84"</span> <span class="attr">Text</span><span class="kwrd">="radiobutton1"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBox</span> <span class="attr">x:Name</span><span class="kwrd">="myTextBox1"</span> <span class="attr">Margin</span><span class="kwrd">="102,134,126,132"</span> <span class="attr">Text</span><span class="kwrd">="Put Some Text Here"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>
     <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">x:Name</span><span class="kwrd">="myTextBlock1"</span> <span class="attr">Height</span><span class="kwrd">="45"</span> <span class="attr">Margin</span><span class="kwrd">="112,0,51,39"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Bottom"</span> <span class="attr">Text</span><span class="kwrd">="TextBlock"</span> <span class="attr">TextWrapping</span><span class="kwrd">="Wrap"</span><span class="kwrd">/&gt;</span>

    <span class="kwrd">&lt;/</span><span class="html">Grid</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">UserControl</span><span class="kwrd">&gt;</span>

</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</td></tr></tbody></table>
<p mce_keep="true">The code for automating it is as follows </p>
<table border="10" cellspacing="0" cellpadding="2" width="700">
<tbody>
<tr>
<td valign="top" width="700"><pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Linq;
<span class="kwrd">using</span> System.Text;
<span class="kwrd">using</span> System.Diagnostics;
<span class="kwrd">using</span> System.Windows.Automation;
<span class="kwrd">using</span> System.Windows.Automation.Provider;
<span class="kwrd">using</span> System.Windows.Automation.Text;
<span class="kwrd">using</span> System.Windows.Forms;
<span class="kwrd">using</span> System.Threading;
<span class="kwrd">namespace</span> WindowsUIAutomationDemo
{
    <span class="kwrd">class</span> Program
    {
        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            <span class="rem">// Start the internet explorer process</span>
            Process p = Process.Start(<span class="str">"iexplore"</span>);
            Thread.Sleep(10000);
            <span class="rem">// Get the handle to the ieWindow</span>
            AutomationElement ieWindow = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.ClassNameProperty,<span class="str">"IEFrame"</span>));
            Thread.Sleep(5000);
            
            <span class="kwrd">if</span> (ieWindow == <span class="kwrd">null</span>)
            {
                Console.WriteLine(<span class="str">"Unable to get handle to the ie main window!"</span>);

            }
            <span class="kwrd">else</span>
            {
                Thread.Sleep(5000);
                <span class="rem">// Specify the condition for getting a reference to the edit control</span>
                Condition[] condition = <span class="kwrd">new</span> Condition[3];
                condition[0] = <span class="kwrd">new</span> PropertyCondition(AutomationElement.ClassNameProperty, <span class="str">"Edit"</span>);
                condition[1] = <span class="kwrd">new</span> PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
                condition[2] = <span class="kwrd">new</span> PropertyCondition(AutomationElement.NameProperty, <span class="str">"Address"</span>);

                <span class="rem">// Getting a reference to the iebar</span>
                AutomationElement iebar = ieWindow.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> AndCondition(condition));

                <span class="kwrd">if</span> (iebar == <span class="kwrd">null</span>)
                {
                    Console.WriteLine(<span class="str">"Unable to get handle to the window !"</span>);

                }
                <span class="kwrd">else</span>
                {
                    <span class="rem">// Set focus and go to the address</span>
                    iebar.SetFocus();
                    SendKeys.SendWait(<span class="str">@"E:\WindowsUIAutomationDemo\SilverlightTestPage\SilverlightTestPage\Bin\Debug\TestPage.html"</span>);
                    SendKeys.SendWait(<span class="str">"{Enter}"</span>);
                    Thread.Sleep(20000);


                    <span class="rem">// Get the reference to the silverlight control </span>
                    AutomationElement silverlightElement = ieWindow.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.ClassNameProperty, <span class="str">"MicrosoftSilverlight"</span>));
                    <span class="kwrd">if</span> (silverlightElement == <span class="kwrd">null</span>)
                    {
                        Console.WriteLine(<span class="str">"Unable to get access to silverligt contorl"</span>);

                    }
                    <span class="kwrd">else</span>
                    {
                        <span class="rem">// click the click me button</span>
                        AutomationElement clickButton = silverlightElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.AutomationIdProperty, <span class="str">"myButton1"</span>));
                        InvokePattern invokePattern = clickButton.GetCurrentPattern(InvokePattern.Pattern) <span class="kwrd">as</span> InvokePattern;
                        invokePattern.Invoke();

                        Thread.Sleep(2000);
                        <span class="rem">// Expand combo box</span>
                        AutomationElement comboBox = silverlightElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.AutomationIdProperty, <span class="str">"myCombo1"</span>));
                        ExpandCollapsePattern expandCollapsePattern = comboBox.GetCurrentPattern(ExpandCollapsePattern.Pattern)  <span class="kwrd">as</span> ExpandCollapsePattern;
                        expandCollapsePattern.Expand();
                        
                        Thread.Sleep(2000)  ;
                        
                        <span class="rem">// Selct the first item </span>
                        AutomationElement firstItemincombo = silverlightElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.NameProperty, <span class="str">"String1"</span>));
                        SelectionItemPattern itemSelection = firstItemincombo.GetCurrentPattern(SelectionItemPattern.Pattern) <span class="kwrd">as</span> SelectionItemPattern;
                        itemSelection.Select();
                        Thread.Sleep(1000) ; 
                        expandCollapsePattern.Collapse();
                        

                        <span class="rem">//Get the radio checkbox</span>
                        AutomationElement checkboxPattern = silverlightElement.FindFirst(TreeScope.Descendants, <span class="kwrd">new</span> PropertyCondition(AutomationElement.AutomationIdProperty, <span class="str">"myCheck1"</span>));
                        TogglePattern tooglePattern = checkboxPattern.GetCurrentPattern(TogglePattern.Pattern) <span class="kwrd">as</span> TogglePattern;
                        tooglePattern.Toggle(); 
                        Thread.Sleep(1000) ; 

                        <span class="rem">// Get the radio button </span>

                        AutomationElement radioButton = silverlightElement.FindFirst(TreeScope.Descendants,<span class="kwrd">new</span> PropertyCondition(AutomationElement.AutomationIdProperty,<span class="str">"myRadio1"</span>));
                        SelectionItemPattern radioCheck =radioButton.GetCurrentPattern(SelectionItemPattern.Pattern) <span class="kwrd">as</span> 
                            SelectionItemPattern;


                        radioCheck.Select(); 
                        Thread.Sleep(1000) ; 

                        <span class="rem">// Get the textbox and put something there </span>

                        AutomationElement textBox = silverlightElement.FindFirst(TreeScope.Descendants,<span class="kwrd">new</span> PropertyCondition(AutomationElement.AutomationIdProperty,<span class="str">"myTextBox1"</span>));
                        ValuePattern valuePattern = textBox.GetCurrentPattern(ValuePattern.Pattern) <span class="kwrd">as</span> ValuePattern;
                        valuePattern.SetValue(<span class="str">"Yo yo , i am entering text !"</span>); 
                        
                      
                        Thread.Sleep(1000); 
                    }

                    
                    <span class="rem">//AutomationElement silverlightControl = ieWindow.FindFirst(TreeScope.Descendants,new PropertyCondition(</span>

                }
            }
            Console.ReadKey();
          
        }
    }
}

</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</td></tr></tbody></table>]]></content:encoded>
    </item>
  </channel>
</rss>