OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 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. |
| 5 |
| 6 """Dump Chrome's ATK accessibility tree to the command line. |
| 7 |
| 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. |
| 10 """ |
| 11 |
| 12 import pyatspi |
| 13 |
| 14 def Dump(obj, indent): |
| 15 if not obj: |
| 16 return |
| 17 indent_str = ' ' * indent |
| 18 role = obj.get_role_name() |
| 19 name = obj.get_name() |
| 20 print '%s%s name="%s"' % (indent_str, role, name) |
| 21 |
| 22 # Don't recurse into applications other than Chrome |
| 23 if role == 'application': |
| 24 if (name.lower().find('chrom') != 0 and |
| 25 name.lower().find('google chrome') != 0): |
| 26 return |
| 27 |
| 28 for i in range(obj.get_child_count()): |
| 29 Dump(obj.get_child_at_index(i), indent + 1) |
| 30 |
| 31 desktop = pyatspi.Registry.getDesktop(0) |
| 32 Dump(desktop, 0) |
OLD | NEW |