C# 跟踪google chorme URL
我想获取我找到此代码的所有选项卡的url 此代码只给我标签标题请告诉我如何获取所有标签urlC# 跟踪google chorme URL,c#,asp.net,C#,Asp.net,我想获取我找到此代码的所有选项卡的url 此代码只给我标签标题请告诉我如何获取所有标签url var automationElements = AutomationElement.FromHandle(proc.MainWindowHandle); // Find `New Tab` element var propCondNewTab = new PropertyCondition(AutomationElement.NameProperty, "New Tab"); var elemN
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());
}
可能重复的So,要明白这一点:您想获取浏览器中所有打开选项卡的URL吗?这听起来有点狡猾,而且不安全。@AGB谢谢你,我已经尝试过了,但它只给我当前的标签URL,我想要所有打开的标签的解决方案tab@DavidT.Macknet是的,上面的代码只给我标签的标题,我想要URL