sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04419
Re: [Question #167279]: Firefox: App.window() returns a region (0, 0), 0x0
Question #167279 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/167279
Status: Open => Answered
RaiMan proposed the following answer:
Guess you are using Firefox 4 or 5.
The browser window, you are looking for is window(1) (usually - at least
after a fresh Firefox start).
comment:
especially on Windows, you can see, that an Application might have many windows, while only one of them is currently visible.
Just make this test:
ffa = "firefox"
ff = App(ffa)
ff.focus()
for i in range(100):
w = ff.window(i)
if not w: break
print i, w
there are some windows at (0,0) or even negative positions. Some of them
have dimension 0x0, others are very small.
If I doubt, that the currently visible app window is App.window() (being
window(0) actually), I make the following filter loop:
ffa = "firefox"
ff = App(ffa)
ff.focus()
for i in range(100):
w = ff.window(i)
if not w: break
if w.x <1 or w.y <1: continue
if w.w <200 or w.h<200: continue # thresholds might vary
print i, w
w.highlight(2)
This usually leaves you with w as being the app window you are looking
for. For one app (Firefox in this case) this is usually stable, so if
you know, the apps frontmost visible window is window(1), you can leave
the filtering and use directly:
ffa = "firefox"
ff = App(ffa)
ff.focus()
w = ff.window(1)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.