title: Get Firefox URL with UI Automation
body: <p>I am trying to get the value of the URL in Firefox using the following code. The problem is it only returns "Search or enter address" (see tree structure with Inspect.exe below). It looks like I need to go one level down. Can someone show me how to do this.</p>
  
  <pre><code>public static string GetFirefoxUrl(IntPtr pointer) {
      AutomationElement element = AutomationElement.FromHandle(pointer);
      if (element == null)
          return null;
      AutomationElement tsbCtrl = element.FindFirst(TreeScope.Subtree, new PropertyCondition(AutomationElement.NameProperty, "Search or enter address"));
      return ((ValuePattern)tsbCtrl.GetCurrentPattern(ValuePattern.Pattern)).Current.Value as string;
  }
  </code></pre>
  
  <p>For the tree structure, see:</p>
  
  <p><img src="https://i.stack.imgur.com/upsz9.png" alt="enter image description here"></p>