0

I want to get url of all tabs I found this code this code give me tabs title only please tell me how I get all tabs url

 var automationElements = AutomationElement.FromHandle(proc.MainWindowHandle);

// Find `New Tab` element

var propCondNewTab = new PropertyCondition(AutomationElement.NameProperty, "New Tab");
var elemNewTab = automationElements.FindFirst(TreeScope.Descendants, propCondNewTab);

// Get parent of `New Tab` element
var treeWalker = TreeWalker.ControlViewWalker;
var elemTabStrip = treeWalker.GetParent(elemNewTab);

// Loop through all tabs
var tabItemCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem);
foreach (AutomationElement tabItem in elemTabStrip.FindAll(TreeScope.Children, tabItemCondition)) {
    var nameProperty = tabItem.GetCurrentPropertyValue(AutomationElement.NameProperty);
    Debug.WriteLine("title: " + nameProperty.ToString());
}
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
noob
  • 11
  • 3
  • 1
    Possible duplicate of [Getting the current tab's URL from Google Chrome using C#](http://stackoverflow.com/questions/18897070/getting-the-current-tabs-url-from-google-chrome-using-c-sharp) – AGB Apr 12 '16 at 19:14
  • 1
    So, to get this straight: you want to get the URL's of all open tabs in a browser? That sounds a bit dodgy, and insecure. – David T. Macknet Apr 12 '16 at 19:29
  • @AGB thank u i have already tried this but its give me only current tab URL ,i want solution for all opened tab – noob Apr 13 '16 at 10:29
  • @DavidT.Macknet yes the above code give me titles of tabs only and i want URL – noob Apr 13 '16 at 10:30

0 Answers0