Wait for object to be displayed

Asked by Akos Kovacs

I use this code to wait for an object: wait(Pattern("1548143854795.png").similar(0.7),30000).
After 20 seconds object is present, but it doesn't wait for it and next operation is not executed, just starts new iteration in the loop.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

The value is seconds, hence 30

Revision history for this message
Akos Kovacs (plaidshirtakos) said :
#2

Thanks, I corrected value, but still not working correctly. It doesn't wait for the end of period, new iteration is started.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

 Not clear what you are doing
Paste more code

Revision history for this message
Akos Kovacs (plaidshirtakos) said :
#4

I click to another object before this and there is just one other command after that:
click("1548143854795.png")

text.each_line do |line|
 click()
 paste()
 click()
 wait(Pattern("1548143854795.png").similar(0.7),30000).
 click("1548143854795.png")
end

Revision history for this message
RaiMan (raimund-hocke) said :
#5

Where do you catch a possible FindFailed?

you said you changed this:
wait(Pattern("1548143854795.png").similar(0.7),30000).

????

Revision history for this message
Akos Kovacs (plaidshirtakos) said :
#6

Sorry, I changed it, but copied line from question. It doesn't wait for 35 seconds, gives FindFailed for object in click() method.

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

My guess:

Your code is:
wait(Pattern("1548143854795.png").similar(0.7),30000).
click("1548143854795.png")

The wait statement looks for an image with similarity of 70% (which probably exists), but the click statement requires 100% similarity (which probably is not there).

Suggestion: try with click() without parameters or click(getLastMatch()) or click(Pattern("1548143854795.png").similar(0.7))

Can you help with this problem?

Provide an answer of your own, or ask Akos Kovacs for more information if necessary.

To post a message you must log in.