1
"""Wrapper code to help when scripting Epiphany
3
Author: David Malcolm <dmalcolm@redhat.com>"""
5
__author__ = 'David Malcolm <dmalcolm@redhat.com>'
7
from dogtail.tree import *
8
from dogtail.distro import *
9
from dogtail.apps.categories import *
11
class EpiphanyApp(Application, WebBrowser):
12
"""Utility wrapper for Epiphany; implements the Webbrowser mixin interface"""
15
Application.__init__(self, root.application("epiphany"))
17
if isinstance(distro, Debian):
18
self.epiPackageName="epiphany-browser"
20
self.epiPackageName="epiphany"
21
self.epiVersion = packageDb.getVersion(self.epiPackageName)
22
print "Epiphany version %s"%self.epiVersion
24
def browseToUrl(self, urlString):
25
# Click on File->New Tab on some epiphany window:
26
newTabMenuItem = self.menu("File").menuItem("New Tab")
27
newTabMenuItem.click()
29
window = EpiphanyWindow(newTabMenuItem.findAncestor(predicate.IsAWindow()))
34
print window.urlEntry().extents
35
window.urlEntry().text = urlString
36
window.urlEntry().doAction('activate')
38
# This is in the final tab; return it:
41
class EpiphanyWindow(Window):
42
def __init__(self, node):
43
Window.__init__(self, node)
44
self.pageTabList = self.child(roleName='page tab list', debugName='Page Tab List')
48
FIXME: not true: Get all tabs of this window as a list of EpiphanyTab instances
50
return self.pageTabList.findChildren (predicate.GenericPredicate(roleName='page tab'), recursive=True)
54
Get the text entry Node for entering URLs.
55
FIXME: this is currently something of a hack
57
# FIXME: we hope that this gives us the correct text entry:
58
return self.child(roleName='text', debugName='URL Entry')
60
# def newTab(self, url):
63
#class EpiphanyTab(Node):
64
# def __init__(self, node, window):
65
# Node.__init__(self, node)
66
# self.window = window