2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Dump Chrome's ATK accessibility tree to the command line.
8 Accerciser is slow and buggy. This is a quick way to check that Chrome is
9 exposing its interface to ATK from the command line.
14 # Helper function to check application name
15 def AppNameFinder(name
):
16 if (name
.lower().find('chromium') !=0 and
17 name
.lower().find('chrome') !=0 and
18 name
.lower().find('google chrome') != 0):
22 def Dump(obj
, indent
):
25 indent_str
= ' ' * indent
26 role
= obj
.get_role_name()
28 print '%s%s name="%s"' % (indent_str
, role
, name
)
30 # Don't recurse into applications other than Chrome
31 if role
== 'application':
32 if (not AppNameFinder(name
)):
35 for i
in range(obj
.get_child_count()):
36 Dump(obj
.get_child_at_index(i
), indent
+ 1)
38 desktop
= pyatspi
.Registry
.getDesktop(0)