public void BackgroundAppTestCase()
        {
            AndroidDriver <IWebElement> driver = new AndroidDriver <IWebElement>(defaultUri, capabilities);

            server.respondTo("POST", "/appium/app/background", null);
            driver.BackgroundApp(5);
        }
        /// <summary>
        /// 应用程序后台休眠
        /// </summary>
        /// <param name="sleepTime"> 后台休眠时长 </param>
        /// <param name="logOutput"> 是否打印执行日志 </param>
        public void BackgroundApp(int sleepTime, bool logOutput = true)
        {
            try
            {
                if (logOutput)
                {
                    LogServe.Info($"应用程序执行后台休眠 => {sleepTime}");
                }

                AndroidDriver.BackgroundApp(TimeSpan.FromSeconds(sleepTime));

                if (logOutput)
                {
                    LogServe.Info($"应用程序结束后台休眠");
                }
            }

            catch (Exception err)
            {
                LogServe.Error($"Error:: 应用程序执行后台休眠异常:: { err.Message }"); throw;
            }
        }
예제 #3
0
 //Send current app to background X seconds
 public void SendToBackground(int seconds)
 {
     androidWebDriver.BackgroundApp(seconds);
 }