title: C#.NET Winform - Get Current Chrome URL takes a long time
body: <p>From below code I can get current Chrome URL but it takes time. Sometime it takes more than 2 Min and sometime it did not return any value.</p>
  <p>Please guide me to solve this problem.</p>
  <pre><code>public string GetActiveTabUrl_Google_Chrome()
  { 
                  
      Process[] procsChrome = Process.GetProcessesByName(&quot;chrome&quot;);
  
      if (procsChrome.Length &lt;= 0)
          return null;
  
      foreach (Process proc in procsChrome)
      {
          // the chrome process must have a window 
          if (proc.MainWindowHandle == IntPtr.Zero)
          {
              continue;
          }
  
          // to find the tabs we first need to locate something reliable - the 'New Tab' button 
  
  
          AutomationElement root = AutomationElement.FromHandle(proc.MainWindowHandle);
          var SearchBar = root.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, &quot;Address and search bar&quot;));
          if (SearchBar != null)
          {                    
              return (string)SearchBar.GetCurrentPropertyValue(ValuePatternIdentifiers.ValueProperty);
  
          }
      }
  }
  </code></pre>
  <p>I've googled a lot but did not get the exact solution. I've tried multiple PC but found the same problem.</p>
  <p>Thanks</p>