BitrixAQA.Selenium.General.ScreenCapture.Printscreen C# (CSharp) Method

Printscreen() public static method

Метод делает принтскрин и записывает файл в папку \screenshots. Возвращает имя файла
public static Printscreen ( bool returnStringPath = false ) : string
returnStringPath bool true - вернуть имя файла в виде простой строки
return string
        public static string Printscreen(bool returnStringPath = false)
        {
            string fileName = "screenshot_" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".png";

            ScreenCapture sc = new ScreenCapture();
            DirectoryInfo dir = new DirectoryInfo(Log.StartupPath + "\\screenshots\\");
            if (!dir.Exists)
                dir.Create();
            sc.CaptureScreenToFile(Log.StartupPath + "\\screenshots\\" + fileName, ImageFormat.Png);
            if (returnStringPath)
                return Log.StartupPath + "screenshots\\" + fileName;
            else
                return "screenshots/" + fileName;
        }