I use Selenium (Chrome driver) to generate screenshots of a page. But sometimes the generated screenshot has whitespace in bottom of the screenshot. It happens randomly. It looks like the render just stops (see screenshot attached).
I tried
- Updated to the latest version of Chrome (60.0.3112.101)
- Updated to the latest version of Selenium.WebDriver (3.5.1)
- Disabled "no-sandbox" and "headless" argument
Code
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--headless");
chromeOptions.AddArgument("--no-sandbox");
var driver = new ChromeDriver(Server.MapPath("bin"), chromeOptions, TimeSpan.FromMinutes(3));
driver.Navigate().GoToUrl("someurl.com");
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(220);
driver.Manage().Window.Size = new Size(4000, 3000);
((ITakesScreenshot)driver).GetScreenshot().SaveAsFile("screenshote.png", ScreenshotImageFormat.Png);
driver.Close();
driver.Quit();
Screenshot
Here is a simple render of a bg image where the render failed.
Update
I cannot give a link to the url, but the same url never fails rendering if I use PhantomJS.