Esempio n. 1
0
 /// <summary>
 /// Make sure the driver is shut down
 /// </summary>
 /// <param name="driver">The driver</param>
 public static void KillDriver(this AppiumDriver <IWebElement> driver)
 {
     try
     {
         driver?.Quit();
     }
     finally
     {
         driver?.Dispose();
     }
 }
        public void DriverQuit(bool forceNoUninstall = false)
        {
            Thread.Sleep(1000);

            try
            {
                if (_deviceTarget.Platform == DevicePlatform.IOs)
                {
                    if (IsBrowser(_packagePath))
                    {
                        AppiumDriver.Close();
                    }
                    else
                    {
                        AppInteraction.CloseApp();
                    }
                    AppiumDriver.Dispose();
                    AppiumDriver.Quit();
                }

                if (_deviceTarget.Platform == DevicePlatform.Android)
                {
                    if (IsBrowser(_packagePath))
                    {
                        AppiumDriver.Close();
                    }
                    else
                    {
                        AppInteraction.CloseApp();
                        if (!String.IsNullOrEmpty(_installedPackageName) && UnInstallOnDriverQuit)
                        {
                            Console.WriteLine("Uninstall app : " + _installedPackageName);
                            AppInteraction.RemoveApp(_installedPackageName);
                        }
                        else
                        {
                            Console.WriteLine("INFO : app not uninstalled !");
                        }
                    }
                    if (!forceNoUninstall)
                    {
                        AppiumDriver.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
        public void GetAndCloseDriverTest()
        {
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Esempio n. 4
0
        public void MobileDeviceTest()
        {
            AppiumDriver driver = AppiumDriverFactory.GetDefaultMobileDriver();

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Esempio n. 5
0
        public void GetWaitDriverTest()
        {
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();
            WebDriverWait wait = AppiumUtilities.GetDefaultWaitDriver(driver);

            try
            {
                Assert.IsNotNull(wait);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Esempio n. 6
0
        public void MobileDeviceTest()
        {
            #region MobileDevice
            AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver();
            #endregion

            try
            {
                Assert.IsNotNull(driver);
            }
            finally
            {
                driver.Quit();
                driver.Dispose();
            }
        }
Esempio n. 7
0
 public void Dispose()
 {
     Driver.Quit();
     Driver.Dispose();
 }
 public void TearDown()
 {
     _driver.Dispose();
 }
Esempio n. 9
0
 public static void CleanUp()
 {
     _driver.Quit();
     _driver.Dispose();
     _driver = null;
 }
Esempio n. 10
0
 public void EndTest()
 {
     driver.Dispose();
     driver.Quit();
 }