Вам нужно пройти через все верхние окна и посмотреть, содержит ли заголовок firefox или проверить класс окна firefox с помощью spy ++, а затем пройти через все дочерние окна, чтобы найти URL, в качестве отправной точки сделайте что-то вроде этого
import win32gui
def enumerationCallaback(hwnd, results):
text = win32gui.GetWindowText(hwnd)
if text.find("Mozilla Firefox") >= 0:
results.append((hwnd, text))
mywindows = []
win32gui.EnumWindows(enumerationCallaback, mywindows)
for win, text in mywindows:
print text
def recurseChildWindow(hwnd, results):
win32gui.EnumChildWindows(hwnd, recurseChildWindow, results)
print hwnd
# try to get window class, text etc using SendMessage and see if it is what we want
mychildren = []
recurseChildWindow(mywindows[0][0], mychildren)
Также вы можете использовать этот модуль для выполнения большинства таких задач http://www.brunningonline.net/simon/blog/archives/winGuiAuto.py.html