示例#1
0
        public void BaseDispose()
        {
            // Explicit logout if we are in issuing page
            try
            {
                ResultState result = TestContext.CurrentContext.Result.Outcome;
                if ("PASSED" != result.Status.ToString().ToUpper() && takeScreenshot)
                {
                    string filePrefix = TestContext.CurrentContext.Test.Name.Split(',')[0].Replace("\"", "").Replace("(", "").Replace(")", "").Replace("Test", "_");
                    string filepath   = TestResultsDir + "/" + filePrefix + "_" + CurrentBrowser + DateTime.Now.ToString().Replace("/", "").Replace(":", "") + ".png";
                    TakeScreenshot(filepath);
                }
                else
                {
                    takeScreenshot = true;
                }
            }
            catch (Exception)
            {
            }
            try
            {
                S1.Logout();
            }
            catch (Exception)
            {
            }

            WebDriver.Quit();
        }