sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01333
Re: [Question #145481]: find sometmes fails and sometimes works
Question #145481 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/145481
Status: Open => Answered
RaiMan proposed the following answer:
-- 1. copy/ paste of scripts inside the IDE (from one tab to another) is
not supported yet. You have to save the script with another name and
then reload the old one if needed.
-- 2. make find more robust
find() cannot be made "more robust". It either finds the requested image within 3 seconds or it fails, if it cannot be found for whatever reason (it is really not yet there after 8 seconds in your case or other reason).
If it is a timing problem: use wait instead of find:
old:
wait(5)
find("123344.png")
new:
wait("123344.png", 20)
only after 20 seconds you would get your FindFailed
-- 3: comment on your script:
the find is absolutely useless, since it does nothing else than stopping the script after 8 seconds if not found.
Your script works, because when starting the IE, a new window is opened and the focus is on the address field, so your type() works.
So this would work also:
openApp("C:\Program Files\Internet Explorer\iexplore.exe")
wait(8)
type("times.com") # use paste() instead
type(Key.ENTER)
If the window is not ready after 8 secs, you will get some beeps ;-)
-- 4: to make your script "more robust"
you could try to not wait for the IE to open, but for your requested webpage to come up
type(Key.ESC, KEY_CTRL) # should open the start menu
paste("http://times.com") # enters the url into the cmd field
type(Key.ENTER) # fires the url
wait("timesLogo.png", 20)
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.