Deterministic screenshotting for automated visual regression testing

Anyone have any advice for more consistent screenshots across crawls?

I am currently passing the following flags to chromium

'--disable-infobars',
'--hide-scrollbars',
'--disable-gpu',
'--disable-webgl',
'--disable-extensions',
'--disable-accelerated-2d-canvas',
'--disable-accelerated-jpeg-decoding',
'--disable-accelerated-mjpeg-decode',
'--disable-accelerated-video-decode',
'--disable-software-rasterizer',
'--disable-notifications',
'--disable-background-networking',
'--disable-background-timer-throttling',
'--disable-dev-shm-usage',
'--font-render-hinting=none',
// '--font-render-hinting=medium',
'--deterministic-mode',
'--force-device-scale-factor=1',
"--disable-partial-raster",
"--force-color-profile=generic-rgb",
'--disable-skia-runtime-opts',
'--disable-lcd-text',
'--disable-font-subpixel-positioning',


Also, I inject the following styles before screenshotting

await page.addStyleTag({content:
* {
                      -webkit-transition: none !important;
                    -moz-transition: none !important;
                    -o-transition: none !important;
                    transition: none !important;
                    -webkit-animation: none !important;
                    -moz-animation: none !important;
                    -o-animation: none !important;
                    animation: none !important;
                    text-rendering: geometricprecision !important;
                    -webkit-font-smoothing: antialiased;
                    }
});
Was this page helpful?