If you have seen this strange issue while running the test in HeadLess mode. You might be getting lower resolution of the images or thumbnail png’s from the site.

Please use below code:

ChromeOptions options= new ChromeOptions();
WebDriver driver =  new ChromeDriver(options);

You can also use Dimension class from Selenium:

Dimension dim = new Dimension(width,height)

Server is checking the headless browser as not needing the higher resolution of the images. This solution will help you to set the widnow-size to “1400,800”. You can try this and take the screenshot of the page. in Headless. You should get higher resolution and clear images.

This is just a small trick 🙂


Naveen AutomationLabs