Ejemplo n.º 1
0
 public static void WaitForClickability(this ElementScope element)
 {
     while (true)
     {
         try
         {
             element.Click();
             return;
         }
         catch (Exception)
         {
             Debug.WriteLine("Элемент заблокирован. Пытаемся кликнуть...");
         }
     }
 }
Ejemplo n.º 2
0
        public bool longClickElement(Coypu.ElementScope clickThis, int waitSeconds = 30, int retrySeconds = 5)
        {
            DateTime quitTime = DateTime.Now.AddSeconds(waitSeconds);

            while (DateTime.Now <= quitTime)
            {
                try
                {
                    clickThis.Click();
                    clickThis.Now();
                }
                catch (Exception)
                {
                    System.Threading.Thread.Sleep(retrySeconds * 1000);
                }
            }
            return(false);
        }