private static void ClickClearContextMenu(this SafeWebDriverWait wait, int index, ClearType clearType)
        {
            var tabCount = wait.Driver.FindElements(By.CssSelector(".nof-tab")).Count;
            var newCount = clearType == ClearType.ClearThis ? tabCount - 1 : clearType == ClearType.ClearOthers ? 1 : 0;

            var webDriver = wait.Driver;
            var tab       = webDriver.FindElements(By.CssSelector(".nof-tab"))[index];
            var loc       = (ILocatable)tab;
            var mouse     = ((IHasInputDevices)webDriver).Mouse;

            mouse.ContextClick(loc.Coordinates);

            var selector = string.Format(".ui-menu-item:nth-of-type({0}) a", (int)clearType);

            wait.Until(wd => wd.FindElement(By.CssSelector(selector)));
            wait.ClickAndWait(selector, wd => wd.FindElements(By.CssSelector(".nof-tab")).Count == newCount);
        }
        // find then click action then wait until f returns true
        public static void ClickAndWait(this SafeWebDriverWait wait, string actionSelector, Func <IWebDriver, bool> f)
        {
            IWebElement action = wait.Driver.FindElement(By.CssSelector(actionSelector));

            wait.ClickAndWait(action, f);
        }
        // Find then click action and wait unitil field selector returns an element
        public static IWebElement ClickAndWait(this SafeWebDriverWait wait, string actionSelector, string fieldSelector, int delay = 0)
        {
            IWebElement action = wait.Driver.FindElement(By.CssSelector(actionSelector));

            return(wait.ClickAndWait(action, fieldSelector));
        }