sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01820
Re: [Question #149990]: Accuracy of image recognizers and actions sikuli.
Question #149990 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/149990
Status: Open => Answered
RaiMan proposed the following answer:
Interestingly people in many cases try to use Sikuli to automate menu-
clicking, without being aware, that it would be much easier to use the
existing keyboard-shortcuts (in this case ctrl-N). Menus of an
application with a windows standard GUI can always be easily automated
using the keyboard (this is how many other automation tools do their
job).
a sequence
switchApp("part of window title of app")
type('n',KEY_CTRL)
is cheaper, faster and more secure.
In your video, the one situation where it did not work, was caused by
the fact, that (I don't know why) the app was inactive (not focused) and
so the first click only activated the window, but did not open the menu
- so the find of the second click failed.
So just put a switchApp() or App().focus() before the first click. I
always give some additional time to the app, to show its window.
So this would be my solution:
switchApp()
wait(0.5)
type('n',KEY_CTRL) (or the clicks here ;-)
One more thing:
It is waste of time and resources to use the whole screen. The search operations should be restricted at least to the app window:
myApp = App("part of window title of app")
reg = myApp.window()
reg.focus()
reg.highlight(1) # a nice alternative to a dumb wait(1)
with reg:
click()
....
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.