5

In jenkins taken screenshots are blank or invalid like in example here:

Jenkins screenshot

Maybe someone knows what kind problem could be with it? Locally everything works fine

WebDriver.ChromeDriver.win32 version - 2.30.0

Selenium.WebDriver version - 3.4.0

Code:

 try
        {
            var screenshotFileName = _filePath + ".png";
            ((ITakesScreenshot) Extensions.Driver).GetScreenshot().SaveAsFile(screenshotFileName, ScreenshotImageFormat.Png);
            Log.Error("Screenshot has been taken: " + screenshotFileName);
        }
        catch (Exception ex)
        {
            Log.Warning("TakeScreenshot failed: " + ex.Message);
        }
krapstuke
  • 155
  • 1
  • 2
  • 7

4 Answers4

3

This seems to be an issue with Chrome 59 itself:

https://bugs.chromium.org/p/chromedriver/issues/detail?id=1844&can=2&start=0&num=100&q=screenshots&colspec=ID%20Status%20Pri%20Owner%20Summary&groupby=&sort=-id

I tried reverting to Chromedriver 2.29, but got the same results (blank screenshot).

paolodm
  • 31
  • 1
2

It seems that this issue happened before. Check this: https://bugs.chromium.org/p/chromedriver/issues/detail?id=476

It's probably bug in new chromedriver 2.30. I had the same issue and the workaround is to connect to VM by Remote Desktop Connection. Problem only occurs when you use selenium remotely and noone is connected to node via RDC.

Hopefully next chromedriver version will fix this.

Dagobah
  • 36
  • 1
1

Jenkins - RobotFramework - Selenium2Library: generated blank screenshots , after downgrade Chrome from v.59 to v.58 problem solved and screenshots are generated as expected. Old versions of Chrome : http://www.slimjet.com/chrome/google-chrome-old-version.php

Jan Vrba
  • 11
  • 1
0

unset TZ before running headless chrome solved the issue with blank screenshots here.

When TZ was set (correctly) to /usr/share/zoneinfo/Europe/Oslo, there were errors in the js console in chrome.

Alexander
  • 121
  • 3