title: How to activate a Google Chrome tab item using UI Automation
body: <p>I am using this code from a C# application to find a tab in Google Chrome:</p>
  
  <pre><code>        Process[] procsChrome = Process.GetProcessesByName("chrome");
          foreach (Process chrome in procsChrome)
          {
              // the chrome process must have a window
              if (chrome.MainWindowHandle == IntPtr.Zero)
              {
                  continue;
              }
  
              AutomationElement root = AutomationElement.FromHandle(chrome.MainWindowHandle);
              /*
              Condition condNewTab = new PropertyCondition(AutomationElement.NameProperty, "Nueva pestaña");
              AutomationElement elmNewTab = root.FindFirst(TreeScope.Descendants, condNewTab);
              // get the tabstrip by getting the parent of the 'new tab' button 
              TreeWalker treewalker = TreeWalker.ControlViewWalker;
              AutomationElement elmTabStrip = treewalker.GetParent(elmNewTab);
               */
              // loop through all the tabs and get the names which is the page title 
              Condition condTabItem = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem);
              foreach (AutomationElement tabitem in root.FindAll(TreeScope.Descendants, condTabItem))
              {
                  Console.WriteLine(tabitem.Current.Name);
  
                  // I NEED TO ACTIVATE THE TAB HERE
  
                  break;
              }
  
              Condition condUrl = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
              foreach (AutomationElement edit in root.FindAll(TreeScope.Descendants, condUrl))
              {
                  string value = ((System.Windows.Automation.ValuePattern)edit.GetCurrentPattern(ValuePattern.Pattern)).Current.Value;
                  Console.WriteLine(value);
              }
  
          }
  </code></pre>
  
  <p>I need to select certain tab item using UI Automation. How can I do it?</p>