/// <summary>
        /// Click an element and validate the click registered by checking for true as the result of the given function.
        /// Due to the nature of the web, it is not uncommon for an element to be clicked but to not actually register the click properly. This method
        /// clicks a given element and waits to ensure the click registered by checking for true as the result of the given condition function.
        /// </summary>
        /// <param name="driver">this</param>
        /// <param name="clickElementSelector">The selector for the element you wish to click.</param>
        /// <param name="conditionFunc">The function used to trigger retry of the click. Returning 'false' indicates a retry condition.</param>
        /// <param name="clickType">Indicates whether the click action should be a single click, double click, or right click on the element. Default = single click.</param>
        public static void ClickAndConfirmByCondition(this IWebDriver driver, By clickElementSelector, Func <bool> conditionFunc, ClickType clickType = ClickType.Single)
        {
            var hasClickedElement = false;

            RetryPolicies.HandleBooleanOrDriverException(false, 20).Execute(() =>
            {
                try
                {
                    driver.ScrollIntoView(clickElementSelector);
                    var clickElement = driver.FindElement(clickElementSelector);

                    switch (clickType)
                    {
                    case ClickType.Single:
                        clickElement.Click();
                        break;

                    case ClickType.Double:
                        new Actions(driver).DoubleClick(clickElement).Perform();
                        break;

                    case ClickType.Right:
                        new Actions(driver).ContextClick(clickElement).Perform();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(clickType), clickType, null);
                    }
                }
                catch (WebDriverException)
                {
                    if (!hasClickedElement)
                    {
                        throw;
                    }
                }

                hasClickedElement = true;

                return(RetryPolicies.HandleBooleanOrDriverException(false, 5).Execute(conditionFunc.Invoke));
            });
        }