Skip to content

Commit 7e54bea

Browse files
committed
Pick mainWindow or a window with a hitpoint
1 parent 6e4207d commit 7e54bea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: src/cljs/calabash_script/utils.cljs

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
[]
1010
(.frontMostApp (target)))
1111

12-
(defn window
13-
[]
14-
(.mainWindow (app)))
15-
1612
(defn windows
1713
[]
1814
(seq (.toArray (.windows (app)))))
1915

16+
(defn window
17+
[]
18+
(let [main (.mainWindow (app))]
19+
(if (.hitpoint main)
20+
main
21+
(first (filter #(.hitpoint %) (windows))))))
22+
2023
(defn keyboard
2124
[]
2225
(.keyboard (app)))

0 commit comments

Comments
 (0)