private AutomationStepRunResult ExecuteStep(AutomationStep step, IWebDriver driver, dynamic state)
        {
            var stepRunResult = new AutomationStepRunResult(step)
            {
                StartTime = DateTime.Now
            };

            Log("[{0}] Starting step '{1}'...", DateTime.Now, step.Description);

            for (int i = 0; i < _options.MaxAllowedStepFailCount; i++)
            {
                stepRunResult.TotalAttemptCount += 1;

                try
                {
                    step.Execute(driver, state);
                    stepRunResult.WasSuccessful = true;

                    Log("[{0}]    Success", DateTime.Now);

                    break;
                }
                catch (Exception ex)
                {
                    stepRunResult.AppendFailedExecution(DateTime.Now, ex);

                    Log("[{0}]    Failure #{1}: {2}", DateTime.Now, stepRunResult.FailedAttemptCount, ex.Message);
                }

            }

            var resultText = stepRunResult.WasSuccessful ? "succeeded" : "failed";

            Log("[{0}] Step '{3}' {1} after {2} attempts.", DateTime.Now, resultText, stepRunResult.TotalAttemptCount, step.Description);

            stepRunResult.EndTime = DateTime.Now;

            return stepRunResult;
        }
 public void AppendStepResult(AutomationStepRunResult automationStepRunResult)
 {
     _stepResults.Add(automationStepRunResult);
 }
 protected virtual void FireStepCompleted(AutomationStepRunResult result, int stepindex, int totalstepcount)
 {
     StepCompleted?.Invoke(result, stepindex, totalstepcount);
 }