3
__author__ = 'David Malcolm <dmalcolm@redhat.com>'
5
# Test of filling in a form in a web browser
6
# Under construction. Doesn't yet work
8
from dogtail.apps.wrappers.epiphany import *
10
class GoogleFrontPage(Node):
11
def __init__(self, node):
12
Node.__init__(self, node)
13
self.searchButton = self.button('Google Search')
14
self.imFeelingLuckyButton = self.button("I'm Feeling Lucky")
16
# Locate the text entry dialog as a sibling of the search button
17
self.textEntry = self.searchButton.parent.child(roleName='text', debugName='Search String Text Entry')
20
dogtail.config.config.debugSearching=True
22
# Epiphany doesn't seem to set the sensitivity state on buttons in web pages:
23
dogtail.config.config.ensureSensitivity=False
27
# Browse to Google front page
28
tab = wb.browseToUrl("http://www.google.com")
31
gfp = GoogleFrontPage(tab)
34
gfp.child(roleName='text').dump()
37
gfp.textEntry.text = "zombie pirates"
38
print gfp.searchButton.actions[0]
39
gfp.searchButton.press()
42
# Scrape out the results:
43
frame = gfp.child(roleName='frame')
44
results = frame.findChildren(predicate.GenericPredicate(roleName='text'), recursive=False)
45
for result in results:
48
print "--------------------------------------"