arsenic icon indicating copy to clipboard operation
arsenic copied to clipboard

tests/test_real_browsers.py::test_get_screenshot[chrome] FAILED

Open dimaqq opened this issue 4 years ago • 2 comments

session = <arsenic.session.Session object at 0x1058477c0>

    async def test_get_screenshot(session):
        await session.get("/screenshot/")
        rect = await session.wait_for_element(5, "#rect")
        screenshot = await session.get_screenshot()
        image = Image.open(screenshot)
        info = await rect.get_rect()
        rect_img = image.crop((info.x, info.y, info.x + info.height, info.y + info.width))
        colors = rect_img.getcolors()
        assert len(colors) == 1
        count, color = colors[0]
        assert count == int(info.width * info.height)
>       assert color == (254, 220, 186, 255)
E       assert (250, 221, 189, 255) == (254, 220, 186, 255)
E         At index 0 diff: 250 != 254
E         Full diff:
E         - (254, 220, 186, 255)
E         ?    ^    ^    ^
E         + (250, 221, 189, 255)
E         ?    ^    ^    ^

It's a small difference, but I wonder why?

(running in the newer-pillow branch, macos, big sur, ChromeDriver 87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761}) )

dimaqq avatar Jan 28 '21 04:01 dimaqq

Is this on macos? I wonder if Apple's fancy TrueTone/NightShift actually affects the pixels in the screenshot taken. I would hope it doesn't, but who knows?

ojii avatar Jan 28 '21 06:01 ojii

on my machine (macos) I also get FAILED tests/test_real_browsers.py::test_get_screenshot[chrome] - assert (249, 221, 190, 255) == (254, 220, 186, 255).

I'm inclined to blame this on Apple trying to be fancy.

ojii avatar Jan 28 '21 08:01 ojii