Forum Discussion

simonaferrara's avatar
simonaferrara
Frequent Contributor
2 years ago

Picture comparison fails if browser window is partially out of the screen

The browser window can be moved (manually or intentionally) partially out of the screen, like in the below example, where I use a virtual machine with Edge browser.

The test automation code contains picture comparisons with benchmark pictures stored in Regions that include the overall browser content (also the content that is partially not shown when the browser window is partially moved out of the screen).

The picture comparison, however, fails, since it use, as actual image for the comparison, the "cropped" image, that is: the "partial" image that is really shown for the user. 

This could cause unexpected failures if the browser windows has been not intentionally moved.

Could it be possible, for the picture comparisons code, to specify to consider as actual image the overall content of the window, instead of the partial one?

 

 

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Capturing an image, is different from capturing an object.

    I always ensure my browser window is maximised and that the screen resolution is always 1920 x 1080 for image comparison to work. 

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        Screen resolution i.e.

        Any form of testing, I ensure my environment is setup appropriately before testing.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    That's ok. You should ensure that your environment is correctly setup before doing automation work, and that your application is in a pre-defined state i.e. window maximised.