public static void SelectOperationsForRowsBasedOnValueForBatch(this IWebElement table, IWebDriver driver,
           int rowNo, string operation)
        {
            Assert.IsTrue(table.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr")).Count > 0,
                "Any row with the desired Cell text/date is not found");

            var flag = true;
            table.WaitForPresent(driver);
            switch (operation)
            {
                case "DeleteReceiptTypeOfBatch":
                    table.FindElement(By.XPath("(//i[text()='clear'])[" + (rowNo + 1) + "]")).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(
                        table.FindElement(By.XPath("(//i[text()='clear'])[" + (rowNo + 1) + "]"))).Click();
                    flag = false;
                    break;

                case "EditReceiptTypeOfBatch":
                    table.FindElement(By.XPath("(//i[text()='mode_edit'])[" + (rowNo + 1) + "]")).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(
                        table.FindElement(By.XPath("(//i[text()='mode_edit'])[" + (rowNo + 1) + "]"))).Click();
                    flag = false;
                    break;

                default:                    
                    break;
            }

            Assert.IsFalse(flag,
                "The desried operation is not found for the particular row: " + rowNo + "Expected Operation: " +
                operation);

        }
        /// <summary>
        /// Change to tab/subtab specified
        /// </summary>
        /// <param name="tab">name of top level tab</param>
        /// <param name="dropDownItem">name of submenu item</param>
        public static void ChangeTab(string tab, string dropDownItem = null)
        {
            //locate the tab link and click it
            WaitHelpers.WaitForElementVisible(By.CssSelector(".nav.top-tab-bar"));
            WaitHelpers.WaitForClickable(By.CssSelector(".nav.top-tab-bar"));
            IWebElement tabStrip = WebDriverFactory.LastDriver.FindElement(By.CssSelector(".nav.top-tab-bar"));
            var xpathLocator = $"//a[descendant::div[contains(@id,\"DetailView_{tab}\")]] | //a[descendant::div[contains(@id,'DetailView_') and contains(.,\"{tab}\")]]";
            WaitHelpers.WaitForElementVisible(By.XPath(xpathLocator));
            IWebElement tabToClick = WaitHelpers.WaitForClickable(tabStrip.FindElement(By.XPath(xpathLocator)));
            WaitHelpers.ExplicitWait();
            tabToClick.Click();
            
            //if drop-down, click the drop-down item
            if (!string.IsNullOrEmpty(dropDownItem))
            {
                //IWebElement element = WebDriverFactory.LastDriver.ExecuteJavaScript<IWebElement>("return $" + "(\"a:has(div:contains(\'Demographics\'))\").filter(\":visible\")" + ".get(0)");
                //element.DrawHighlight();

                //var els = tabToClick.FindElements(By.XPath($"//a[descendant::div[contains(.,\"{dropDownItem}\")]]"));
                //foreach (var e in els)
                //{
                //    if (e.Displayed) { e.Click(); }
                //}
                //IWebElement dropDownToClick = WaitHelpers.WaitForClickable(tabToClick.FindElement(By.XPath($"//a[descendant::div[contains(.,\"{dropDownItem}\")]]")));
                //dropDownToClick.Click();

                WebDriverFactory.LastDriver.FindElement(CustomBy.jQuery($"(\"a:has(div:contains(\'{dropDownItem}\'))\").filter(\":visible\")")).Click();
            }
            WaitHelpers.WaitForAjaxLoad();
        }
        /// <summary>
        /// Perform selected operation on a row of a table For Order Module
        /// </summary>
        /// <param name="table">IWebElement table</param>
        /// <param name="driver">IWebDriver</param>
        /// <param name="rowNo">Index of row to perform operation.</param>
        /// <param name="operation">Operation to perform</param>
        public static void SelectOperationsForRowsBasedOnValueForOrderModule(this IWebElement table, IWebDriver driver, int rowNo, string operation)
        {
            WaitHelpers.ExplicitWait(200);
            Assert.IsTrue(table.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr")).Count > 0, "Any row with the desired Cell text/date is not found");

            var flag = true;
            table.WaitForPresent(driver);
            WaitHelpers.ExplicitWait(200);
            var row = table.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr"))[rowNo];
            switch (operation)
            {
                default:
                    var cell = row.FindElement(By.XPath(".//div[contains(@id,'ActionsMenu')]/button/i"));
                    cell.DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(cell).Click();
                    WaitHelpers.ExplicitWait(250);
                    if (cell.FindElements(By.XPath(".//parent::*//parent::*//ul//li//a//span")).Any(e => e.Text.ToLower().Equals(operation.ToLower())))
                    {
                        WaitHelpers.WaitForClickable(cell.FindElements(By.XPath(".//parent::*//parent::*//ul//li//a//span")).Where(e => e.Text.ToLower().Equals(operation.ToLower())).ToArray()[0]).Click();
                        flag = false;
                    }
                    break;                                
            }
            Assert.IsFalse(flag, "The desried operation is not found for the particular row: " + rowNo + "Expected Operation: " + operation);
        }
        /// <summary>
        /// Perform selected operation on a row of a table.
        /// </summary>
        /// <param name="table">IWebElement table</param>
        /// <param name="driver">IWebDriver</param>
        /// <param name="rowNo">Index of row to perform operation.</param>
        /// <param name="operation">Operation to perform</param>
        public static void SelectOperationsForRowsBasedOnValue(this IWebElement table, IWebDriver driver, int rowNo, string operation)
        {
            WaitHelpers.ExplicitWait(200);
            Assert.IsTrue(table.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr")).Count > 0, "Any row with the desired Cell text/date is not found");

            var flag = true;
            table.WaitForPresent(driver);
            WaitHelpers.ExplicitWait(200);
            var row = table.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr"))[rowNo];
            switch (operation)
            {
                case "Edit":
                    row.FindElement(By.XPath("(//i[text()='mode_edit'])[" + (rowNo + 1) + "]")).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(row.FindElement(By.XPath("(//i[text()='mode_edit'])[" + (rowNo + 1) + "]"))).Click();
                    flag = false;
                    break;

                case "Go To Details":
                    row.FindElement(By.XPath("(//i[text()='keyboard_arrow_right'])[" + (rowNo + 2) + "]")).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(row.FindElement(By.XPath("(//i[text()='keyboard_arrow_right'])[" + (rowNo + 2) + "]"))).Click();
                    flag = false;
                    break;

                case "Expand_More":
                    //WaitHelpers.WaitForClickable(table.FindElement(By.XPath("(//i[text()='expand_more'])[" + (rowNo + 3) + "]"))).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(table.FindElement(By.XPath($"(//i[text()='expand_more' and contains(@class, 'actionButton')])[{rowNo + 1}]"))).DrawHighlight(driver);
                    table.FindElement(By.XPath($"(//i[text()='expand_more' and contains(@class, 'actionButton')])[{rowNo + 1}]")).Click();
                    flag = false;
                    break;

                case "Expand_Less":
                    //table.FindElement(By.XPath("(//i[text()='expand_more'])[" + (rowNo + 1) + "]")).DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(table.FindElement(By.XPath($"(//i[contains(text(), 'expand_less') and contains(@class, 'actionButton')])[{rowNo + 1}]"))).DrawHighlight(driver);
                    table.FindElement(By.XPath($"(//i[contains(text(),'expand_less') and contains(@class, 'actionButton')])[{rowNo + 1}]")).Click();
                    flag = false;
                    break;
                
                case "Transfer Credit":
                    var cell = row.FindElement(By.CssSelector(".material-icons.dropdown-toggle"));
                    cell.DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(cell).Click();
                    WaitHelpers.ExplicitWait(250);
                    WaitHelpers.WaitForClickable(table.FindElement(By.XPath($"(//a[text()='Transfer Credit'])[{rowNo + 1}]"))).DrawHighlight(driver);
                    table.FindElement(By.XPath($"(//a[text()='Transfer Credit'])[{rowNo + 1}]")).Click();
                    flag = false;
                    break;

                case "Add New Order":
                    cell = row.FindElement(By.CssSelector(".material-icons.dropdown-toggle"));
                    cell.DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(cell).Click();
                    WaitHelpers.ExplicitWait(250);
                    if (cell.FindElements(By.XPath(".//parent::*//ul//li//a")).Any(e => e.Text.ToLower().Contains("Add New Order".ToLower())))
                    {
                        WaitHelpers.WaitForClickable(cell.FindElements(By.XPath(".//parent::*//ul//li//a")).Where(e => e.Text.ToLower().Contains("Add New Order".ToLower())).ToArray()[0]).Click();
                        flag = false;
                    }
                    break;


                default:
                    cell = row.FindElement(By.CssSelector(".material-icons.dropdown-toggle"));
                    cell.DrawHighlight(driver);
                    WaitHelpers.WaitForClickable(cell).Click();
                    WaitHelpers.ExplicitWait(250);
                    if (cell.FindElements(By.XPath(".//parent::*//ul//li//a")).Any(e => e.Text.ToLower().Equals(operation.ToLower())))
                    {
                        WaitHelpers.WaitForClickable(cell.FindElements(By.XPath(".//parent::*//ul//li//a")).Where(e => e.Text.ToLower().Equals(operation.ToLower())).ToArray()[0]).Click();
                        flag = false;
                    }
                    break;
            }            
            Assert.IsFalse(flag, "The desried operation is not found for the particular row: " + rowNo + "Expected Operation: " + operation);
        }
 /// <summary>
 /// Clicks the element located using the By.
 /// </summary>
 /// <param name="by">By locator of element to click </param>
 public static void Click(this By by)
 {
     WaitHelpers.WaitForClickable(by).Click();
 }
 /// <summary>
 /// Gets current value of Kendo ComboDropdown
 /// </summary>
 /// <param name="by">By locator Kendo ComboDropDown</param>
 /// <returns>Current selected value of the combo</returns>
 public static string GetCurrentValueofComboDropdown(this By by)
 {
     return WaitHelpers.WaitForClickable(by).GetCurrentValueofComboDropdown();
 }
 /// <summary>
 /// Retrieves all values from a Kendo ComboDropDown
 /// </summary>
 /// <param name="by">By locator for Kendo ComboDropDown</param>
 /// <returns>Dictionary with values from the Kendo ComboDropDown element.</returns>
 public static Dictionary<string, string> GetAllValueFromComboDropdown(this By by)
 {
     return WaitHelpers.WaitForClickable(by).GetAllValueFromComboDropdown();
 }
 /// <summary>
 /// Sets text in a standard input element.
 /// </summary>
 /// <param name="by">By locator of the textbox element.</param>
 /// <param name="text">Text to enter into the textbox.</param>
 public static void SetTextStandardTextBox(this By by, string text)
 {
     WaitHelpers.WaitForClickable(by).SetTextStandardTextBox(text);
 }