I'm trying to get the url of the current window using Python (in case having focus navegator), but I couldn't, it shows Error.
Could someone guide me please, i'm new in python (i'm Java developer).
import time
import win32gui
import uiautomation as auto
_active_window_name = None
while True:
window = win32gui.GetForegroundWindow()
chromeControl = auto.ControlFromHandle(window)
edit = chromeControl.EditControl()
#print(dir(chromeControl.EditControl()))
print(edit.GetValuePattern().Value)
time.sleep(5)