コード例 #1
0
        private void InitializeApplication()
        {
            var appPath          = this.Automator.ActualCapabilities.App;
            var appArguments     = this.Automator.ActualCapabilities.Arguments;
            var debugDoNotDeploy = this.Automator.ActualCapabilities.DebugConnectToRunningApp;
            var processName      = this.Automator.ActualCapabilities.ProcessName;
            var launchDelay      = this.Automator.ActualCapabilities.LaunchDelay;


            if (processName.Length == 0)
            {
                DriverManager.StartApp(appPath, appArguments, debugDoNotDeploy);
                Thread.Sleep(launchDelay);
            }
            else
            {
                if (!debugDoNotDeploy)
                {
                    DriverManager.CloseDriver();
                    DriverManager.CloseAllApplication(processName);
                }

                try
                {
                    DriverManager.StartApp(appPath, appArguments, debugDoNotDeploy);
                }
                catch
                {
                }

                Thread.Sleep(launchDelay);
                DriverManager.AttachToProcess(processName);
            }
        }
コード例 #2
0
        protected override string DoImpl()
        {
            if (!this.Automator.ActualCapabilities.DebugConnectToRunningApp)
            {
                DriverManager.CloseDriver(this.Automator.ActualCapabilities.App.StartsWith("#"));

                this.Automator.ElementsRegistry.Clear();
            }

            return(this.JsonResponse());
        }
コード例 #3
0
        public void Event()
        {
            ChromeOptions op = new ChromeOptions();

            op.EnableMobileEmulation("Apple iPhone 4");
            //DriverFactory.Instance.DriverOption = op;
            DriverManager.StartDriver(Browser.ChromeDesktop);
            IWebDriver driver = DriverManager.GetDriver <IWebDriver>();

            driver.Url = "https://www.whatismybrowser.com/";
            IWebElement el = driver.FindElement(By.XPath("//*[@id='holder']//*[@class='detection-primary content-block']"));

            WebKeywords.Instance.GetScreenShot();
            Utilities.Instance.GetWebElementBaseImage(el, formatType: System.Drawing.Imaging.ImageFormat.Jpeg);
            driver.Dispose();
            DriverManager.CloseDriver();
        }
コード例 #4
0
 public void Finish()
 {
     try
     {
         var webKeyWords = Resolve <IWebKeyWords>();
         webKeyWords.GetScreenShot();
     }
     catch (Exception e)
     {
         Console.WriteLine("Ocorreu um erro ao capturar o Screenshot :(");
         throw new Exception(e.Message);
     }
     finally
     {
         DriverManager.CloseDriver();
     }
 }
コード例 #5
0
        public void CloseDriver()
        {
            try
            {
                var    status       = CurrentContext.Result.Outcome.Status;
                var    stacktrace   = CurrentContext.Result.StackTrace;
                var    errorMessage = CurrentContext.Result.Message;
                var    screenShot   = Capture($"{CurrentContext.Test.ClassName}_{CurrentContext.Test.ID}");
                Status logStatus;
                string message = $"Test ended with ";
                switch (status)
                {
                case TestStatus.Failed:
                    logStatus = Status.Fail;
                    message  += $"{logStatus} - {errorMessage}";
                    childTest.Log(logStatus, $"Test ended with {logStatus} - {errorMessage}");
                    break;

                case TestStatus.Skipped:
                    logStatus = Status.Skip;
                    message  += $"{logStatus}";
                    break;

                default:
                    logStatus = Status.Pass;
                    message  += $"{logStatus} ";
                    break;
                }
                childTest.Log(logStatus, message, screenShot);
                // remove data
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);
                foreach (var obj in _setUpContext.GetObejcts())
                {
                    helper.Delete(obj);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                DriverManager.CloseDriver();
            }
        }
コード例 #6
0
 public void TearDown()
 {
     DriverManager.CloseDriver();
     NodeFactory.Instance.CloseNodeServer();
 }
コード例 #7
0
 public void TearDown()
 {
     DriverManager.CloseDriver();
 }
コード例 #8
0
 public void QuitDriver()
 {
     DriverManager.CloseDriver();
 }
コード例 #9
0
ファイル: TestBase.cs プロジェクト: grin7/pageObject
 public void TestCleanup()
 {
     driver.Manage().Cookies.DeleteAllCookies();
     driver = DriverManager.CloseDriver();
 }
コード例 #10
0
 public void cleanUp()
 {
     Console.WriteLine("Stop run test....");
     DriverManager.CloseDriver();
 }
コード例 #11
0
 public void KillDriver()
 {
     DriverManager.CloseDriver();
     DriverManager = null;
 }
コード例 #12
0
ファイル: BaseTest.cs プロジェクト: luci2797/DotNetTraining
 public void Cleanup()
 {
     DriverManager.CloseDriver();
 }
コード例 #13
0
 /// <summary>
 /// Custom on after test configuration method for Dynamo application.
 /// </summary>
 protected override void OnAfterTest()
 {
     DriverManager.CloseDriver();
 }
コード例 #14
0
 public void Dispose()
 {
     _driver.Close();
     _driver.Dispose();
     DriverManager.CloseDriver();
 }