Example #1
0
        public void WEBTestTakeScreenshot()
        {
            using (var xrmBrowser = new Api.Browser(TestSettings.Options))
            {
                xrmBrowser.LoginPage.Login(_xrmUri, _username, _password);
                xrmBrowser.GuidedHelp.CloseGuidedHelp();

                ScreenshotImageFormat fileFormat = ScreenshotImageFormat.Tiff;  // Image Format -> Png, Jpeg, Gif, Bmp and Tiff.
                string strFileName = String.Format("Screenshot_{0}.{1}", DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"), fileFormat);
                xrmBrowser.TakeWindowScreenShot(strFileName, fileFormat);
                if (!File.Exists(strFileName))
                {
                    Assert.Fail(String.Format("Following file '{0}' was not found", strFileName));
                }
                else
                {
                    Console.WriteLine(Path.GetFullPath(strFileName));
                }
            }
        }