[Sikuli-driver] [Question #207285]: image comparison fails

2012-08-30 Thread Felix
New question #207285 on Sikuli:
https://answers.launchpad.net/sikuli/+question/207285

Hi,

I'm struggling with sikulis image matching possibilities. I'm testing if a 
website loaded correctly. The test fails if a blank page shows up.

1) First approach:
Look into screen region and test if blank_page.png (1021x672 pixel) exists.

#screen region // screen size ipad 
screenRegion = Region(1,43,1020,804)

#create match object
imageBlank = Pattern("blank_page.png")

if screenRegion.exists(imageBlank): 
print "debug: blank screen, website failed to load correctly" 
else:
print "ok"


2) Second approach:
Make a screenshot of the website and test if it's blank.

screenRegion = Region(1,43,1020,804)

imageScreenRaw = capture(screenRegion)

#match object
imageScreen = exists(imageScreenRaw)

#region from screenshot
imageScreenRegion = Region(imageScreen)

imageBlank = Pattern("blank_page.png")

if imageScreenRegion.exists(imageBlank):
print "debug: blank screen, website failed to load correctly"
else:
print "ok"


The blank screen differs a 100% from the region or captured sreenshot, but both 
test approaches fail unfortunately. What's wrong? Does it matter if I test 
against a 10x10 blank png or a 1021x672 pixel?

Any help on this issue is highly appreciated. Thanks in advance for sharing 
your experience.

regards



-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #207285]: image comparison fails

2012-08-31 Thread dinev
Question #207285 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207285

Status: Open => Answered

dinev proposed the following answer:
I just done simple test on https://launchpad.net/sikuli with to see how
recorded image is recognized.  it works fine with exception that it is
relatively slow on my 21" widescreen.

But in general i think the approach of validating if web site is loaded
is not correct. I would suggest following

-- On the site homepage take 2 - 3 major elements that should be
present. They may be ones that you will use afterwards anyway. Search
for them

-- Copy the whole content of the page by clicking in the middle and
doing ctrl-a-c. The using the power of python check that some expected
texts are there and some unexpected are not there(like "exception" and
"error")

I believe that above approach is more reliable since it will tolerate
significant changes in website layout.

Hope this helps

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #207285]: image comparison fails

2012-09-02 Thread RaiMan
Question #207285 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207285

RaiMan requested more information:
does blank_page.png mean a totally white (or uni-color) area?

If yes: this is problematic (but should work with latest version r930).

Another thing:

Look into screen region and test if blank_page.png (1021x672 pixel)
exists.

#screen region // screen size ipad
screenRegion = Region(1,43,1020,804)

Since the image is 1 pixel wider than the region, this will never be
found.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #207285]: image comparison fails

2012-09-03 Thread Felix
Question #207285 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207285

Status: Answered => Open

Felix is still having a problem:
Thanks for your replies,

@dinev
I thought about taking visual elements of the website and validate against 
them, but I'm looking for a more general approach so I can easily change the 
tested websites without touching the sikuli script.

@raiman
You're right, by blank page I mean a totally white (uni-color) are, e.g. you 
type about:blank in your browser's address bar and hit enter. I'm going to give 
r930 a try.

What do you think? Which approach should I take? Which is one is more
stable in terms of correct image comparision results?

thanks in advance

regards

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #207285]: image comparison fails

2012-09-03 Thread RaiMan
Question #207285 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207285

Status: Open => Answered

RaiMan proposed the following answer:
--- but I'm looking for a more general approach so I can easily change the 
tested websites without touching the sikuli script.
Generally this is a good idea, but my (and other people's) experiences tell me, 
that this is usually combined with a huge scripting effort.
I think each Sikuli script will have some specifics about the images used 
(different browsers, resolutions, systems, ... ) that lead to different 
versions of the same script.
The only thing one should do: identify often used workflows and turn them in 
classes/methods/functions, that can be reused.

--- Which is one is more stable in terms of correct image comparision results?
I agree (and usually use) dinev's approach: looking for some key visuals, that 
should be there, to be sure, the workflow might proceed.
You might put this check in a function or functions, that accept some 
parameters (list of images, expected regions, combination logic, ...)

examples:

checkAll(images, reg = SCREEN):
ret = True
for image in images:
if not reg.exists(image, 0):
ret = False
break
return ret   

checkSome(images, reg = SCREEN):
ret = False
for image in images:
if reg.exists(image, 0):
ret = True
break
return ret

usage:

browser = App("your browser")   
if not checkAll( ("image1.png", "image2.png", "image3.png" ), 
browserApp.window() ):
 print "makes no sense to go on"; exit(1)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #207285]: image comparison fails

2012-09-03 Thread RaiMan
Question #207285 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/207285

RaiMan posted a new comment:
You could even use this approach, to check wether some white area is
contained in the browser window.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp