galen icon indicating copy to clipboard operation
galen copied to clipboard

Image's area is incorrect

Open nplatonova opened this issue 9 years ago • 12 comments

Hi! I use Galaxy S5 (v 4.4.2), Appium 1.3.5, Win 7, Browser - Chrome 40.0.2214 on device chromedriver 2.14 I try to compare images using galen, but area of image on site was defined incorrect. This image I want to check http://screencast.com/t/6v54qY4eFIy

It's my spec banner css img[src='Application/_includes/img/ico-news.png']

@ Banner | *

banner image: file ..\banners\ico-news.png, error 14%, tolerance 80

But in report I see, that galen tries to compare with incorrect element http://screencast.com/t/rZ8kmRNPu

If I try to check long banner, I receive such error java.lang.RuntimeException: Specified area is outside for original image http://screencast.com/t/9LosOpUc

Can you help me pls? Thanks!

nplatonova avatar Feb 27 '15 07:02 nplatonova

You are getting the error "Specified area is outside for original image" because you have horizontal scrollbars. Therefore the screenshot that Selenium creates is less then the actual area of an element. I still haven't figured out how to solve this problem in Chrome and on mobile devices.

As for the first error I am not sure what is happening. Never saw such problem before. Could you maybe prepare a small spec file with only banner element and image spec and put it on https://gist.github.com/ ? Also please provide the website url and your sample image so I can check whats going on with it.

ishubin avatar Feb 27 '15 07:02 ishubin

Spec and web site you can find here https://gist.github.com/nplatonova/59a37ad3670bf258ff67

image you can download from this link https://yadi.sk/i/4hlTV-d0evHmL

nplatonova avatar Feb 27 '15 09:02 nplatonova

@nplatonova now I see what the issue is. You were using the original icon from the website. If you open that sample icon you will see that it only has one white color of the icon and the rest is transparent. But galen takes a screenshot of the website and compares with the given sample. But your sample does not include the background. If you want to use image comparison you can also look into Page Dump functionality for generating image samples. Checkout this video tutorial https://www.youtube.com/watch?v=bheFQfEGR6U

ishubin avatar Feb 27 '15 09:02 ishubin

So, I try to use screenshot, which takes galen (stored in \target\galen-html-reports) http://screencast.com/t/YitPSBzf Why is icon not full on it (I mean on actual image)? Is my selector in spec incorrect? Selenium IDE tells me, that all right. =\

nplatonova avatar Feb 27 '15 10:02 nplatonova

@nplatonova It seems like it it takes the incorrect area from the screenshot. Could you please post a complete html report generated by galen. I want to see how it actually takes the screenshot and maybe there is some offset like it normally is on iOS devices (I haven't seen this on android devices yet)

ishubin avatar Mar 05 '15 14:03 ishubin

Yep, of course https://yadi.sk/d/1kJkmF3Of57a2

nplatonova avatar Mar 06 '15 02:03 nplatonova

Are there any updates on this issue? I am facing the exact same issue. Furthermore, I found out that if the page is being scrolled (for example by entering some values through the page) issue rises to a new level. So Galen gets the position and size of the element and captures that area, but if the page is scrolled Galen does not automatically scroll the page so the element we want to capture is in its expected area but captures the wrong area instead. image comparison issue

semsuddin avatar Apr 03 '17 08:04 semsuddin

Hi @ishubin, I am also facing the same issue. I have a question, why are we so dependent on WebDrivers ability to take the screenshot. I learned that screenshot ability is inherently unstable in WebDriver (IEDriver actually).

Can we not have galen's own way to generate the full page screenshot? And during compare layout we could have the same method to compare the Image.

dhapolapankaj avatar Jul 11 '17 11:07 dhapolapankaj

In my own issue, I believe the problem is that it's taking one additional screenshot of blank space, and thus failing on that, because it's somehow getting a slightly different screen size. I will likely have to manually pad the master image to ensure it passes.

zfolwick avatar Feb 23 '18 20:02 zfolwick

@zfolwick Can you post your example with spec file and HTML report if it is possible?

cyildirim avatar Feb 25 '18 16:02 cyildirim

I have a logo in footer section but by using Galen when am trying to validate same...am getting error like java.lang.RuntimeException: The page element is located outside of the screenshot. (Element {x: 301, y: 1398, w: 329, h: 43}, Screenshot {w: 1920, h: 889})

Could anyone please help me?

QATestAnalyst avatar Jan 04 '19 11:01 QATestAnalyst

Hi Everyone anyone got any solution for this I also facing the same issue. Screenshots taken by Galen contains area outside the element also.

gauravmishra72 avatar Aug 15 '20 05:08 gauravmishra72