שתף באמצעות


get all tabs url in google chrome

Question

Wednesday, July 31, 2013 12:20 PM

Hi,

i want to get the all opened urls in the google chrome to save in a text file

waiting for reply....

thanks in advance....

All replies (2)

Wednesday, July 31, 2013 1:47 PM

See the below link. It looks like each Chrome tab is a separate process so you can probably just enumerate the Chrome processes:

http://stackoverflow.com/questions/16305238/get-url-from-all-open-tabs-in-google-chrome-using-vb-net-and-ui-automation

Paul ~~~~ Microsoft MVP (Visual Basic)


Thursday, April 24, 2014 5:44 PM

 

Import first UIAutomationClient and UIAutomationTypes

Dim procsChrome As Process() = Process.GetProcessesByName("chrome")
                    For Each chrome As Process In procsChrome
                        If chrome.MainWindowHandle = IntPtr.Zero Then Continue For
                        Dim elm As AutomationElement = AutomationElement.FromHandle(chrome.MainWindowHandle)
                        Dim elmUrlBar As AutomationElement = elm.FindFirst(TreeScope.Descendants, New PropertyCondition(AutomationElement.NameProperty, "Address and search bar"))
                        If elmUrlBar IsNot Nothing Then
                            Dim patterns As AutomationPattern() = elmUrlBar.GetSupportedPatterns()
                            If patterns.Length > 0 Then
                                Dim val As ValuePattern = DirectCast(elmUrlBar.GetCurrentPattern(patterns(0)), ValuePattern)
                                If Not elmUrlBar.GetCurrentPropertyValue(AutomationElement.HasKeyboardFocusProperty) Then MsgBox (LCase(val.Current.Value).Trim)
                                Exit For
                            End If
                        End If
                    Next