public void Click(eByType byType, string locator)
        {
            IWebElement element = null;

            element = findElement(byType, locator);
            if (element != null)
            {
                element.Click();
            }
        }
        public void SendText(eByType byType, string locator, string textToEnter)
        {
            IWebElement element = null;

            element = findElement(byType, locator);
            if (element != null)
            {
                element.Clear();
                element.SendKeys(textToEnter);
            }
        }
        private IWebElement findElement(eByType type, string locator)
        {
            IWebElement element = null;

            try
            {
                switch (type)
                {
                case eByType.ID:
                    element = driver.FindElement(By.Id(locator));
                    break;

                case eByType.NAME:
                    element = driver.FindElement(By.Name(locator));
                    break;

                case eByType.XPATH:
                    element = driver.FindElement(By.XPath(locator));
                    break;

                case eByType.LINK_TEXT:
                    element = driver.FindElement(By.LinkText(locator));
                    break;

                case eByType.CSS:
                    element = driver.FindElement(By.CssSelector(locator));
                    break;

                case eByType.CLASS:
                    element = driver.FindElement(By.CssSelector(locator));
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                if (e.ToString().Contains("OpenQA.Selenium.NoSuchElementException"))
                {
                    Console.WriteLine("Element with locator - " + locator + " not found.");
                }
            }
            return(element);
        }
        public string GetAttributeVal(eByType byType, string locator, eAttributeValue attribute)
        {
            IWebElement element        = null;
            string      attributeValue = "";

            element = findElement(byType, locator);
            if (element != null)
            {
                if (attribute == eAttributeValue.Checked)
                {
                    attributeValue = element.Selected.ToString();
                }
                else if (attribute == eAttributeValue.Visible)
                {
                    attributeValue = element.Displayed.ToString();
                }
                else if (attribute == eAttributeValue.Text)
                {
                    attributeValue = element.Text;
                }
            }
            return(attributeValue);
        }