Exemplo n.º 1
0
        /// <summary>
        /// Waits for an element to be hidden
        /// </summary>
        /// <param name="elementInfo">Repository Item Info of the element to check</param>
        /// <param name="timeout">How long I want to wait for the element to be hidden</param>
        /// <returns>true if the element is not visible</returns>
        public static bool WaitForElementHidden(RepoItemInfo elementInfo, Duration timeout)
        {
            bool visible     = true;
            int  checkPeriod = 500; // ms

            // if timeout is longer than a second then check periodically every checkPeriod ms
            if (timeout > 1000)
            {
                int countMax = timeout.Milliseconds / checkPeriod;
                int count    = 0;

                while (count < countMax && visible)
                {
                    visible = CheckItem.checkVisible(elementInfo, 0);
                    Thread.Sleep(checkPeriod);
                    count++;
                }
            }
            else
            {
                Thread.Sleep(timeout.Milliseconds);
                visible = CheckItem.checkVisible(elementInfo, 0);
            }
            return(!visible);
        }