コード例 #1
0
ファイル: BaseTest.cs プロジェクト: FestTestQA/AO
 public static void GrabScreen()
 {
     foreach (var(Username, Driver, _) in DriverHelper.GetAllDriversByPid())
     {
         var _screenShotPath = ScreenshotHelper.GetFileName(TestExecutionContext.CurrentContext.CurrentTest.FullName + "_" + Username.Replace("@", ""));
         WaitHelper.WaitUntil(() =>
         {
             try
             {
                 ((ITakesScreenshot)Driver).GetScreenshot().SaveAsFile(_screenShotPath);
                 return(true);
             }
             catch
             {
                 return(false);
             }
         });
         Console.WriteLine("Screenshot saved at: " + _screenShotPath + " for PID: ");
         _screenShotPath = ScreenshotHelper.GetFileName($"{TestExecutionContext.CurrentContext.CurrentTest.Properties.Keys.FirstOrDefault(k => k == "AllureTag")}_{TestExecutionContext.CurrentContext.CurrentTest.FullName}_{Username.Replace("@", "")}");
         ((ITakesScreenshot)Driver).GetScreenshot().SaveAsFile(_screenShotPath);
     }
 }