Skip to content Skip to sidebar Skip to footer

How To Get Url From Chrome By Python

I want to analyze the chrome activity which sites are open in current tab even if it open into the next tab also using python 3 . Please can anyone provide link or any suggestion h

Solution 1:

I have face same problem with accessing Chrome's address bar, but found a way to do it with pywinauto library. See code below.

from pywinauto import Application
app = Application(backend='uia')
app.connect(title_re=".*Chrome.*")
dlg = app.top_window()
url = dlg.child_window(title="Adreso ir paieškos juosta", control_type="Edit").get_value()
print(url)

"Adreso ir paieškos juosta" is element name of Chrome address bar as I am using Chrome with Lithuanian language, it is in Lithuanian. If you want to find element's name use inspect.exe, it will show the name. You can find more info about inspect.exe in pywinauto documentation page or just google it.

Hope this will help you.

Post a Comment for "How To Get Url From Chrome By Python"