[pygtk] Close alert/prompt dialogs
Martin Strand
do.not.eat.yellow.snow at gmail.com
Wed Jan 2 14:54:13 WST 2008
I'm using gtkmozembed to automatically generate screenshots for a number
of sites. I simply open up a browser window and loop through a few
thousand urls, taking a screenshot of each page.
Some sites however make modal dialogs appear (javascript alerts, password
prompts, security warnings, etc) Unfortunately I can't ignore these and
simply continue to the next url, the dialog has to be closed first. This
must be done programmatically since it's supposed to be an automatic tool.
I can't even destroy() the main window until the dialog disappears so the
screenshot loop just freezes...
I suppose there's a way to find these dialogs that pop up and close them
programmatically, but I'm completely new to pygtk (and python) so I'm a
little lost. Help?
widget = gtkmozembed.MozEmbed()
parent = gtk.Window()
parent.add(widget)
parent.show_all()
# I guess I need this
parent.find_the_modal_dialog_that_is_blocking_me().destroy()
More information about the pygtk
mailing list