示例#1
0
        private void Execute(IActor actor)
        {
            var  startTime    = DateTimeOffset.Now;
            bool hasSucceeded = false;

            while (!hasSucceeded)
            {
                try
                {
                    InnerAction.ExecuteWhenAs(actor);
                    hasSucceeded = true;
                }
                catch (WebDriverException)
                {
                    if (DateTimeOffset.Now.Subtract(startTime) > Timeout)
                    {
                        throw;
                    }
                    Thread.Sleep(500);
                }
                catch (InvalidOperationException)
                {
                    if (DateTimeOffset.Now.Subtract(startTime) > Timeout)
                    {
                        throw;
                    }
                    Thread.Sleep(500);
                }
            }
        }