title: Get url from all open tabs in Google Chrome using VB .Net and UI Automation
body: <p>Hello I have this code working to get current url on Chrome, but only get active tab url. I need to get url from all open tabs using UI Automation.</p>
  
  <p>My working code:</p>
  
  <pre><code>Function GetChromeUrl(ByVal proc As Process) As String
      If proc.MainWindowHandle = IntPtr.Zero Then
      Return Nothing
  End If
  
  Dim element As System.Windows.Automation.AutomationElement = AutomationElement.FromHandle(proc.MainWindowHandle)
  If element Is Nothing Then
      Return Nothing
  End If
  
  Dim edit As System.Windows.Automation.AutomationElement = element.FindFirst(TreeScope.Children, New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit))
  Return (edit.GetCurrentPattern(ValuePattern.Pattern)).Current.Value.ToString
  End Function
  </code></pre>
  
  <p>and call it using this code in Form Load event:</p>
  
  <pre><code>For Each proc As Process In Process.GetProcessesByName("chrome")
      MsgBox(proc.MainWindowTitle + " " + GetChromeUrl(proc))
  Next
  </code></pre>