This python code, works with Redhat's Dogtail to auto-magically click "OK" button on an "Authentication Required" popup:
from dogtail import tree
from dogtail.utils import run
from time import sleep
from os import environ, path, remove
import sys
environ['LANG']='en_US.UTF-8'
#print tree.root.dump()
firefox = tree.root.application('Firefox')
#print firefox.dump()
#print dir(firefox)
#print firefox.findChildren()
auth_required = firefox.childNamed("Authentication Required")
#auth_required = firefox.child(name="Authentication Required")
ok_button = auth_required.childNamed("OK")
ok_button.click()
print 'ok button clicked now'
#print dir(ok_button)
NOTE:
Doing gui-automation this way may be a "bad idea", but I'm only doing this automation to scrape an internal webpage, and it only has to work on a very specific configuration -- Ubuntu 10.04 with Firefox.
No comments:
Post a Comment