Why I always see the content changed --- use similar(0.99) instead of exact()

Asked by stanley huang

I am trying to monitor a website to see if the content is changed
But I always got "content changed" even nothing changed from my eye (all content is the same include picture, text..etc)
(It seems the website will keep updating every sec even content is the same)

Below is my sample code

r= capture(Region(776,142,65,17))
sleep(5)
if exists(Pattern(r).exact()):
 print "content is the same"
else:
 print "content changed"

I always got "content changed" even nothing changed.
I try to remove Pattern but result is the same.
I think the problem may be caused by website updating every sec.

I also use "wait()" and "waitVanish()" instead exists(). The result is the same.
Does anyone know the problem or any suggestion for me?

Question information

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

try to use

if exists(Pattern(r).similar(0.99)):

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

using exact(), with is similar(1.0) seems to make problems.

Revision history for this message
stanley huang (stanleyh07) said :
#3

Thanks RaiMan

It works properly.

Revision history for this message
stanley huang (stanleyh07) said :
#4

Thanks RaiMan, that solved my question.