summaryrefslogtreecommitdiff
path: root/sw/qa/complex
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/complex')
-rw-r--r--sw/qa/complex/accessibility/AccessibleRelationSet.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/sw/qa/complex/accessibility/AccessibleRelationSet.java b/sw/qa/complex/accessibility/AccessibleRelationSet.java
index f8323fce450c..562bcfe98d7e 100644
--- a/sw/qa/complex/accessibility/AccessibleRelationSet.java
+++ b/sw/qa/complex/accessibility/AccessibleRelationSet.java
@@ -169,10 +169,25 @@ public class AccessibleRelationSet {
XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
- XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel);
- XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
-
- XAccessibleContext ctx = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT_TEXT);
+ XAccessibleContext ctx;
+ for (int i = 0;; ++i) {
+ XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ ctx = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT_TEXT);
+ if (ctx != null) {
+ break;
+ }
+ if (i == 20) { // give up after 10 sec
+ throw new RuntimeException(
+ "Couldn't get AccessibleRole.DOCUMENT_TEXT object");
+ }
+ System.out.println("No DOCUMENT_TEXT found yet, retrying");
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
para1 = ctx.getAccessibleChild(0);
para2 = ctx.getAccessibleChild(1);